This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: unalignment override




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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]