Date: Fri, 30 Mar 2001 10:48:42 -0500 From: John Franklin <franklin@elfie.org> To: Lord Isildur <mrfusion@umbar.vaxpower.org> Cc: tech-kern@netbsd.org, freebsd-hackers@FreeBSD.ORG Subject: Re: Question regarding the array of size 0. Message-ID: <20010330104842.B25316@elfie.org> In-Reply-To: <Pine.3.89.10103301045.B22782-0100000@umbar>; from mrfusion@umbar.vaxpower.org on Fri, Mar 30, 2001 at 10:37:28AM -0500 References: <20010330101929.B24999@elfie.org> <Pine.3.89.10103301045.B22782-0100000@umbar>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 30, 2001 at 10:37:28AM -0500, 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 */
Could, true. Buf if foo is:
struct foo{
struct header head;
struct funcystruct data[0];
}
you can say:
mesg->head->headerbits;
mesg->data[x]->databits;
A bit more readable, IMHO.
jf
--
John Franklin
franklin@elfie.org
ICBM: N37 12'54", W80 27'14" Z+2100'
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010330104842.B25316>
