#pragma align=mac68k produces incorrect alignment when used inside a template class
#pragma align=mac68k produces incorrect alignment when used inside a template class
- Subject: #pragma align=mac68k produces incorrect alignment when used inside a template class
- From: Rua Haszard Morris <email@hidden>
- Date: Mon, 15 May 2006 10:36:28 +1200
I've found that alignment pragmas don't work correctly when used
within a template class declaration for example:
template <class LocalDataT> class AffectsAlignment {
public:
#pragma options align=mac68k
struct ParameterRecordIntsideClass { // sizeof == 16
void* ExtP_LocalData;
union {
struct {
short ExtP_Channel;
Boolean ExtP_CanOnLine;
} vc_1;
StringPtr ExtP_CalcName;
struct {
short ExtP_UBlock;
short ExtP_UChan;
Boolean ExtP_UUnique;
MLUnitConvertPtr ExtP_TheUnits;
} vc_8;
} variant;
};
#pragma options align=reset
};
#pragma options align=mac68k
struct ParameterRecordOutsideClass { // sizeof == 14
void* ExtP_LocalData;
union {
struct {
short ExtP_Channel;
Boolean ExtP_CanOnLine;
} vc_1;
StringPtr ExtP_CalcName;
struct {
short ExtP_UBlock;
short ExtP_UChan;
Boolean ExtP_UUnique;
MLUnitConvertPtr ExtP_TheUnits;
} vc_8;
} variant;
};
#pragma options align=reset
The alignment pragmas don't seem to have any effect on the structure
declared in the class. Namespace and non-template class declarations
do not reproduce the problem.
Obviously the workaround for this is just to declare the structure
outside the class - but I'd be interested to know if this is expected
behaviour or alternatively a compiler bug. We use alignment pragmas
throughout our code, and if there are problems with their use under
gcc we might need to look at updating them more urgently. We've only
recently moved to Xcode/gcc - until recently we were developing with
Codewarrior, and would prefer to maintain compatibility with both
IDEs for the time being.
Thanks,
Rua HM.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden