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
[EMAIL PROTECTED]
ICBM: N37 12'54", W80 27'14" Z+2100'

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to