Path: utzoo!utgpu!tmsoft!tslanpar!woods From: woods@tslanpar.UUCP (Greg A. Woods ) Newsgroups: comp.lang.c Subject: Re: what C needs -- packed structures Summary: This should read "What C does NOT need."! Keywords: structures pack data layout Message-ID: <83@tslanpar.UUCP> Date: 26 Jan 88 00:30:19 GMT References: <8801071842.AA04669@decwrl.dec.com> Reply-To: woods@tslanpar.UUCP ( -Greg A. Woods- ) Distribution: world Organization: G. A. W. Consulting Lines: 21 I'm sorry, but a compile time flag is far from what could solve problems with imposing structure on external data. Just how do you expect to compile a module that must load data into a packed structure on one line, and then perform an ioctl() call on the next to work? (Most kernel's and device drivers won't use packed structures!) How are you to prevent an unknowing programmer from doing such a thing? The "-pack" option of the Microsoft family of C compilers (yes it's still there in Xenix) was a quick and dirty fix for Lattice's mistake of packing structures in the first place (it wastes a lot of CPU time in may implementations). The only possible solution could be the pseudo-functions: pack() and unpack() ala Pascal. I personally have had no problems with bit/byte wise manipulation of external data (using bitfields and unsigned character arrays). -- Greg Woods. UUCP: utgpu!woods, utgpu!{ontmoh, tmsoft!tslanpar}!woods, woods@tslanpar VOICE: (416) 242-7572 LOCATION: Toronto, Ontario, Canada