top | item 40469355

(no title)

jacinabox | 1 year ago

The C language has rules around 'effective type' which determine what object type a block of memory can have, while the C++ language has rules around object model which does basically this AND requires that a constructor is called on an object before it is properly regarded as being of that object type. In my opinion the reason why the C++ standard cares about object lifetime is because C++ structs can have reference members which are required to be initialized in any instance of that struct type. In contrast it's compatible with what C has of an object model to just say to language users "If an object is in static or automatic storage the constructor is called automatically but if an object is in heap storage it's up to the user to call the constructor themselves."

amateur C++ coder

discuss

order

No comments yet.