>Hi,
>
>I'm looking for a generic opinion on the use of "#pragma pack" for writing 
>Solaris code. I know it's useful for device register sets, or data structures 
>that don't follow ABI layout rules.
>
>We use #pragma pack(4) at a few places in Solaris (for example, the SVM 
>on-disk 
>layout data structures on Solaris/x86).

Really?  That's bad.

>Should such a use be allowed or discouraged for new code ? I.e. if I have a 
>data structure that is packed (no padding, contains misaligned multibyte 
>entities), should I better write a convertor function or were it ok to use 
>#pragma pack(1) ?

It should be DISALLOWED.

If you want to store persistent data, better define it somewhere, not
let the compiler make it up.

Casper
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to