POD

Walter Bright newshound2 at digitalmars.com
Fri Dec 28 14:44:40 PST 2012


On 12/20/2012 4:12 AM, Andrej Mitrovic wrote:
> On 12/20/12, Maxim Fomin <maxim at maxim-fomin.ru> wrote:
>> How presence of ctor/dtor/postblit affect the POD (in a sense of
>> changing structure size and alignment)?
>
> It doesn't, but the semantics are different. For example if you pass
> your struct to the C side the C code might do copies of your struct
> but it will have no idea about your postblits or destructors.


There's more than that. POD structs can exist solely in registers. Having 
ctor/dtor/postblit means that structs cannot be enregistered, because those 
operations require a pointer to the instance.

There are subtleties to it. It affects all kinds of things like ABI call/return 
issues, varargs, etc.

There needs to be an easy way to query a type to see if it is POD, and currently 
there isn't one.


More information about the Digitalmars-d mailing list