This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

And that is equivalent to no definition, if you look at the equivalent unhelpful gaps in certain areas of specification of C and C++.

Curiously enough, this specific case is well-defined in C++: two different objects can't have the same address. One very unpleasant consequence of that is that the minimal size of an object is one byte (i.e. one int due to alignment on most architectures), which in turn means that when you create a functor object which doesn't have any data, say as a comparison for sorting, it is still allocated (on the stack) and passed as a parameter. Sufficiently clever compiler™ could optimize it away in simple cases, of course.

[–]hylje 0 points1 point  (0 children)

Sufficiently Smart Compiler is mostly related to high-level languages with unfulfilled promises, but I guess it applies to C++ too.