Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [C++]Undefined Behaviour

    Undefined Behaviour o comportamento indefinito....questo sconosciuto!
    In C++ quando si ha?
    Io fin'ora ho trovato questo....
    1) dereferencing a null pointer
    2) accessing outside the bounds of an array
    3) deleting the same memory twice
    4) dereferencing a pointer after it has been deleted
    5) dereferencing a pointer which points to a destroyed object
    6) accessing an uninitialised variable
    7) signed integer overflow
    8) modifying a const object
    1) main returning void
    2) Copying a pointer after it has been deleted
    3) Using mismatched forms of new/delete for arrays
    4) Modifying a string literal
    5) Changing a variable twice without a sequence point
    6) Instantiating an STL container with auto_ptr
    7) Adding declarations/definitions to std namespace
    8) Playing around with reinterpret_cast
    1) Dividing by zero
    2) Pointer arithmetic that crosses array bounds
    3) Returning a reference or pointer to a local variable
    4) Writing to a member of a union and then reading another one
    5) Deleting a derived class object though a pointer to a base class that
    has no virtual destructor
    7) Using offsetof on a non-POD class/struct
    8) Using a map/set with a comparison function with no strict/weak
    ordering for the key type
    9) Accessing vector members that don't exist
    10)Using a container iterator after it has become invalid
    9) modifying a variable twice between sequence points (or accessing the
    value being modified).
    e.g. a = ++i + ++i; or a = i + ++i;
    10) deleting a derived class through a pointer to a base class whose
    destructor is not virtual.
    Ci parliamo un po sopra o è inutile?
    Imho, no
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  2. #2
    Utente di HTML.it L'avatar di anx721
    Registrato dal
    Apr 2003
    Messaggi
    2,352
    Bhe non so quanto sia utile, semplicemente il linguaggio non specifica cosa bisogna fare in questi casi, che sono quindi da considerare errori, quello che avviene poi dipende dal compilatore...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.