Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COyes, this address identity thing is what really annoys me here. While I can guess it could have use, an object whose address is not taken amounts to an object that is not used (since invoking any method on it requires its address) and I don't see how a C++ compiler could realize an object is unused apart from all in-lined classes. Do you know why this non-zero is used for ? (ie if it's a remnant of C or still has used in more modern style)
      singulars
    2. CO@Matthieu: well, I suppose that non-zero size of complete objects is so you can do `sizeof(array)/sizeof(*array)` and not divide by zero. I can't think of a strong rationale for non-zero size of member subobjects - if you need some member objects with different addresses, you (the programmer) could just make sure they're of type `char` rather than `EmptyThing`. I guess there's somewhere in the object/memory model that would need special-case handling, and it's just simpler to assume that member subobjects are distinct and non-overlapping.
      singulars
    3. COI've updated my question somewhat. I am not requiring a non-zero size of complete objects (though that too could be nice, allowing heaps of other optimizations, and `sizeof` is compile-time code too, so no worry of a divide by zero exception at runtime anyway). I don't understand why if we can have EBO (that is a zero-size base class) we cannot have EDMO (that is a zero-size data member).
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload