c++ - DMC bug?
- Nick Sabalausky (15/16) Oct 31 2012 Little rusty on C, so not sure if this is a compiler bug or not (I'm
- Nick Sabalausky (6/16) Oct 31 2012 I should point out I came across that in an existing C lib, a release
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));
Oct 31 2012
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.
Oct 31 2012








Nick Sabalausky <SeeWebsiteToContactMe semitwist.com>