October 31, 2012 DMC bug? | ||||
---|---|---|---|---|
| ||||
Little rusty on C, so not sure if this is a compiler bug or not (I'm using DMC 8.42n): ------------------------------------ typedef struct { int a; } Foo; int bar = (sizeof ((Foo*)0)->a); ------------------------------------ > dmc -c test.c int bar = (sizeof ((Foo*)0)->a); ^ m.c(5) : Error: ')' expected --- errorlevel 1 FWIW, Adding an additional set of parens like below gets around the error: int bar = (sizeof (((Foo*)0)->a)); |
October 31, 2012 Re: DMC bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Wed, 31 Oct 2012 03:29:50 -0400 Nick Sabalausky <SeeWebsiteToContactMe@semitwist.com> wrote: > Little rusty on C, so not sure if this is a compiler bug or not (I'm > using DMC 8.42n): > > ------------------------------------ > typedef struct { > int a; > } Foo; > > int bar = (sizeof ((Foo*)0)->a); > ------------------------------------ I should point out I came across that in an existing C lib, a release version, so presumably it works on at least *some* C compiler. Just not sure whether or not it *should* work, or (for all I know) maybe it's one of those "undefined" areas of the langauge. |
Copyright © 1999-2021 by the D Language Foundation