This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: unalignment override
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: unalignment override
- From: "Christian Groessler" <cpg at aladdin dot de>
- Date: Wed, 24 Feb 1999 01:26:40 +0100
- cc: Joe Buck <jbuck at Synopsys dot COM>,egcs at egcs dot cygnus dot com
On 24/2/99 0:48:57 Richard Henderson wrote:
>
>Also, better is to write that function like so
>
> static inline int read_dword (void *address)
> {
> struct {
> int data __attribute__((packed));
> } *p = address;
>
> return p->data;
> }
>
>Gcc knows how to optimize unaligned loads described in this manner.
Good, but the app with which I have this problem, should also compile
with other compilers besides egcs/gcc.
Using "void *address" and typecast-accessing (unsigned char *) the single
bytes of the int should (always?) work in egcs/gcc, too ? (see my previous
mail).
thanks for your help,
chris