TDPL error(s)
dolive
dolive89 at sina.com
Sun May 8 08:19:41 PDT 2011
Denis Koroskin Wrote:
> On Sun, 08 May 2011 17:59:02 +0400, Timon Gehr <timon.gehr at gmx.ch> wrote:
>
> > On page 263, TDPL states that struct objects nested inside a function
> > cannot
> > be returned, because the caller does not have access to their types.
> > Using the
> > auto keyword, DMD lets you do this though. Is this a bug in DMD or an
> > error in
> > TDPL?
> >
>
> I think that's fine.
>
> > On the same page, the assert should be
> > assert(Local.sizeof == size_t.sizeof + int.sizeof);
> >
> > rather than
> > assert(Local.sizeof == 2*size_t.sizeof);
> >
> > which always fails in 64 bit.
> >
> >
> > Timon
>
> Without looking at the code, I'd assume that Local is defined something
> like this:
>
> struct Local
> {
> size_t s;
> int i;
> }
>
> in which case Local.sizeof would most likely be size_t.sizeof * 2 because
> of the alignment and implicit padding, i.e 8 bytes on x86, and 16 bytes on
> x64. size_t.sizeof + int.sizeof only give 12.
>
> I'd agree that this is in fact confusing and needs to be explained.
Why ddmd dont continue ? Give up ?
More information about the Digitalmars-d
mailing list