Subject: Re: Question regarding the array of size 0.
To: Lord Isildur <>
From: Benny Prijono <>
List: tech-kern
Date: 03/30/2001 17:03:49
Lord Isildur wrote:
> sine one knows the size of the struct, who need the pointer? just
> take the displacement.
> char* buf; /* some buffer */
> struct foo{
> int header;
> struct funkystruct blah;
> };
> (struct foo*)buf; /*your headers are here */
> (struct foo*)buf+1; /* and your data is here */


personally, I still prefer buf[0], because I think it's more readable.
It's clear for the reader that the struct will be allocated larger
than sizeof(struct foo), while with macro, that's not immediately

btw, anybody can list compilers that reject buf[0] (inside struct)? MS
visual C doesn't seem to complain either.

> Isildur