On 9/15/12 5:19 PM, Stefan Teleman wrote:
On Sat, Sep 15, 2012 at 4:57 PM, Liviu Nicoara <nikko...@hates.ms> wrote:

Yes, but it restores the default packing, not an arbitrary one, potentially
set by the user prior to including our headers. Say, the user sets 2, the
default is 4 and we set 8. When we set it to default it goes back to 4,
instead of the expected 2. Did I get this right?

This is true, but leaving some arbirary pragma pack(N) (for N != 0) in
effect for the duration of a program, and expecting it to work sounds
like a very defective programming approach to me. It will certainly
not work on SPARC at all.  if the program needs to pack something in a
certain specific way, it need to do so for that specific something
only. Otherwise the side-effects of globally setting a non-default
packing will destroy the program anyway.

I merely wanted to point out that restoring the default packing is not the same as restoring the packing to the previous value in effect.

Given this, I thought about an alternative way of forcing this alignment, e.g., via a union, aligned on an appropriate type. I see an advantage here in that most of the changes would occur where we define the 'primitive' mutex and condition wrappers, saving a few pre-processor conditionals and pragmas along the way.

What do you think?

Liviu

Reply via email to