I'm having problems moving a bunch of legacy code to Mach and CWP9.
When you have 68k alignment turned on the following returns 8 with
Mach, but returns 6 with PEF:
#include <iostream>
typedef unsigned long ulong;
struct BookREC {
short bmanLocks;
ulong field1:3;
ulong field2:6;
ulong field3:2;
ulong field4:1;
ulong field5:1;
ulong field6:8;
ulong field7:1;
ulong field8:1;
ulong field9:7;
ulong field10:1;
ulong field11:1;
};
int main()
{
using namespace std;
cout << sizeof(BookREC) << endl;
return 0;
}
Has anyone else ran across this? Any ideas on how to get around this?
We probably have thousands of structs that use bit fields with no
easy way to find the ones that have problems. We were planning on
finally upgrading from CWP8 to CWP9, but this is a show stopper. This
works fine in CWP8 Update 3.
Thanks,
Bill
MW Ron - 15 Jan 2004 14:30 GMT
>I'm having problems moving a bunch of legacy code to Mach and CWP9.
>When you have 68k alignment turned on the following returns 8 with
[quoted text clipped - 36 lines]
>finally upgrading from CWP8 to CWP9, but this is a show stopper. This
>works fine in CWP8 Update 3.
I see this too, let me check with the PowerPC engineers.
Ron

Signature
Metrowerks, maker of CodeWarrior - "Software Starts Here"
Ron Liechty - MWRon@metrowerks.com - <http://www.metrowerks.com>
MW Ron - 15 Jan 2004 17:39 GMT
We have a solution
#pragma old_style_bitfields on
I don't know why this wasn't documented in the release notes.
I tried your example with 68k alignment and it worked
Ron
>I'm having problems moving a bunch of legacy code to Mach and CWP9.
>When you have 68k alignment turned on the following returns 8 with
[quoted text clipped - 39 lines]
>Thanks,
>Bill

Signature
Metrowerks, maker of CodeWarrior - "Software Starts Here"
Ron Liechty - MWRon@metrowerks.com - <http://www.metrowerks.com>