- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the document said that -funsigned-bitfieldsDetermines whether the default bitfield type is changed tounsigned. but what is default bitfield type?
thanks in advance.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By default it is treated as signed int but this may be changed by the -funsigned-bitfields option.
You may learn more on it by following http://gcc.gnu.org/onlinedocs/gcc/Structures-unions-enumerations-and-bit_002dfields-implementation.html
You may learn more on it by following http://gcc.gnu.org/onlinedocs/gcc/Structures-unions-enumerations-and-bit_002dfields-implementation.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
The default bitfield type signed. Gcc manual gives more details below.
The default bitfield type signed. Gcc manual gives more details below.
----------
-fsigned-bitfields
-funsigned-bitfields
-fno-signed-bitfields
-fno-unsigned-bitfields
These options control whether a bit-field is signed or unsigned, when the declaration does not use either signed or unsigned. By default, such a bit-field is signed, because this is consistent: the basic integer types such as int are signed types.
----------
Thanks,
Feilong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank all.
I got it.
a.c:
struct node
{
int a:2; //no unsigned or signed before int
};
if compiled by icc -funsigned-bitfieds a.c , field a is unsigned int .
if compiled by icc a.c, field a is signed int.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page