* Packing structures with gcc
@ 2000-10-05 23:15 Robert Rati
2000-10-06 5:04 ` David Edelsohn
0 siblings, 1 reply; 2+ messages in thread
From: Robert Rati @ 2000-10-05 23:15 UTC (permalink / raw)
To: linuxppc-dev
Hi all
I am trying to read a byte stream into a structure and padding shifts
the members of the structure. How do I turn on packing of the structures
to ensure no padding. I am working with gcc version 2.95.3 on a Linux
ppc distribution with 2.2.13 kernel and glibc 2.1.3. I have tried using
the -fpack-struct option with no luck. Are there options to the
standard binary distributions of gcc for struct packing, or do I need to
compile gcc from source? I have tried compiling gcc 2.95.3 with compile
version 2.95.3 and I get an internal compiler error. Upon looking at
the gcc source, it appears that HANDLE_SYSV_PRAGMA needs to be defined
(according to c-pragma.h), but how would I configure the makefiles in
the gcc source to enable this option correctly? Would appreciate any
help with this.
Thanks
Rob
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Packing structures with gcc
2000-10-05 23:15 Packing structures with gcc Robert Rati
@ 2000-10-06 5:04 ` David Edelsohn
0 siblings, 0 replies; 2+ messages in thread
From: David Edelsohn @ 2000-10-06 5:04 UTC (permalink / raw)
To: Robert Rati; +Cc: linuxppc-dev
Have you looked at the "__attribute__ ((packed))" functionality in
the GCC documentation under C Extensions -- Variable Attributes? That
should allow you to pack the members of the structure when it is
declared.
David
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-10-06 5:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-10-05 23:15 Packing structures with gcc Robert Rati
2000-10-06 5:04 ` David Edelsohn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).