Subject: Re: Driver for hardware sensors in G4 iBooks and probably other Macs
To: Michael <macallan18@earthlink.net>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: port-macppc
Date: 12/13/2004 20:55:40
Michael <macallan18@earthlink.net> writes:

> Sure. That leads to my newbie-question - where and how are the device
> structs allocated? I think they get some sort of well-defined
> alignment then? Maybe these things should be allocated separately to
> avoid alignment mismatches in the future.

Structures will be allocated with natural alignment rules, as per
C. My recollection is that this means that a structure will be aligned
to the largest alignment required by any of its members, and each
member will be aligned according to its natural data type. But if you
have, say, a structure that only gets 4-byte alingment but needs
16-byte alignment, then you can invoke that by tacking on
__attribute__ ((__aligned__(16))).

        - Nathan