POD

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Dec 28 15:58:46 PST 2012


On 12/28/12, Walter Bright <newshound2 at digitalmars.com> wrote:
> 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.

These are good points and reminds us that we need to update the
documentation, there's a section that reads:

"In C++ parlance, a D struct is a POD (Plain Old Data) type, with
trivial constructors and destructors."

It needs further explanation. Just a few weeks ago someone tried to
add a non-trivial constructor in a D struct which interfaces with C
and his code stopped working, these are likely the reasons why.


More information about the Digitalmars-d mailing list