[cpp-threads] pthreads (was: RE: C++ Connections proposal)

Nelson, Clark clark.nelson at intel.com
Tue Apr 26 23:12:53 BST 2005


> My guess is that some compilers might currently perform 
> transformations
> like this, but it would be easy to teach them to stop when we teach
> them that only adjacent bit-fields can be spuriously rewritten.
> And I believe we need to do that anyway.

I'm sorry, but I'm afraid the adjacent bit-field rule isn't good enough.
Consider a case like the following:

struct X { char a; int b: 16; char c; };

Reasonable ABIs can (and the Itanium ABI does) put a into byte 0, b into
bytes 1 and 2, and c into byte 3, and to access b will use a 4-byte
memory instruction, because a 2-byte access would be unaligned.

-- 
Clark Nelson		Vice chair, J16 (ANSI C++ standard committee)
Intel Corporation
clark.nelson at intel.com




More information about the cpp-threads mailing list