From owner-freebsd-hackers Fri Mar 30 7:49: 2 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from elfie.org (elfie.org [207.198.61.53]) by hub.freebsd.org (Postfix) with ESMTP id E4A8837B71A for ; Fri, 30 Mar 2001 07:48:57 -0800 (PST) (envelope-from franklin@elfie.org) Received: (from franklin@localhost) by elfie.org (8.11.0/8.10.2) id f2UFmgE25686; Fri, 30 Mar 2001 10:48:42 -0500 (EST) Date: Fri, 30 Mar 2001 10:48:42 -0500 From: John Franklin To: Lord Isildur Cc: tech-kern@netbsd.org, freebsd-hackers@FreeBSD.ORG Subject: Re: Question regarding the array of size 0. Message-ID: <20010330104842.B25316@elfie.org> References: <20010330101929.B24999@elfie.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.9i In-Reply-To: ; from mrfusion@umbar.vaxpower.org on Fri, Mar 30, 2001 at 10:37:28AM -0500 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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