All Forums |
Register |
Login |
Search |
Subscriptions |
My Profile |
Inbox |
Tool Warehouse |
FAQs |
Resources |
Help |
Member List |
Address Book |
Logout |
|
|
gcc vs c89 (aka cl.exe)
|
Logged in as: Guest |
Users viewing this topic: none |
|
Login |
|
|
gcc vs c89 (aka cl.exe) - Mar. 15, '06, 10:13:19 AM
|
|
|
rjnorman
Posts: 12
Joined: Jan. 27, '06,
Status: offline
|
My application has many flags implemented as follows:
long flg1:1;
long flg2:1;
.etc...
In one structure I have 64 of these flags in a row. On most other Unix/Linux systems these 64 flag bits take up 8 bytes. Using c89 they take up 8 bytes, but using gcc they seem to be assigned 24 bytes.
Does anyone have an idea how I can tell gcc to treat this the same as c89 and all other C compilers?
Thanks
|
|
|
RE: gcc vs c89 (aka cl.exe) - Mar. 16, '06, 4:42:20 PM
|
|
|
rjnorman
Posts: 12
Joined: Jan. 27, '06,
Status: offline
|
I found the bug. I actually had nothing to do with bit fields. My struct also had an arrary of some other struct.
If that array did not begin on an 8 byte boundary then gcc would compute the offset of the fields following the array incorrectly. If I inserted an ' int filler; ' before my array then gcc computes the field offsets the same as c89.
So this looks like a bug in gcc.
Cheers
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
|
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|
|