Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: printing members of a structure |
| Date | 2015-03-02 14:28 -0500 |
| Organization | Self |
| Message-ID | <54F4B9E1.1090603@verizon.net> (permalink) |
| References | <mcop3s$953$4@dont-email.me> <i710fahl72mm5hjbobjcbgpdup4va39muv@4ax.com> <mcp9iu$vq$2@dont-email.me> <md2aqs$16c$1@dont-email.me> |
On 03/02/2015 01:40 PM, Nick Bowler wrote: ... > ... The C specification does not > define promotion for bit-fields of types other than _Bool, int, > signed, or unsigned (note that the C standard leaves all other types of > bit-fields implementation-defined). ... "If an int can represent all values of the original type (as restricted by the width, for a bit-field), the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions.58) All other types are unchanged by the integer promotions." 6.3.1.1p2 The promotions depend upon the implementation-defined values of INT_MIN and INT_MAX, and depend upon the implementation-defined range of values allowed for each integer type. For bit-fields, the range is uniquely determined by the size in bits, except with regard to the handling of the sign bit for signed bit fields. I'd expect the sign bit to be handled the same way as it is in the corresponding non-bit-field type, but it's arguable whether or not that's clearly required. However, modulo those issues, 6.3.1.1p2 uniquely determines the promoted type and the promoted value. > ... So you can try to figure out what > your compiler actually does from its documentation and/or experiment, Such experimentation is therefore needed only for determining whether the implementation is conforming.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
printing members of a structure bilsch <king621@comcast.net> - 2015-02-27 03:42 +0000
Re: printing members of a structure Ian Collins <ian-news@hotmail.com> - 2015-02-27 17:37 +1300
Re: printing members of a structure bilsch <king621@comcast.net> - 2015-02-27 08:21 +0000
Re: printing members of a structure Richard Heathfield <rjh@cpax.org.uk> - 2015-02-27 08:26 +0000
Re: printing members of a structure bilsch <king621@comcast.net> - 2015-02-27 10:37 +0000
Re: printing members of a structure Barry Schwarz <schwarzb@dqel.com> - 2015-02-27 03:16 -0800
Re: printing members of a structure bilsch <king621@comcast.net> - 2015-02-27 12:52 +0000
Re: printing members of a structure jt@toerring.de (Jens Thoms Toerring) - 2015-02-27 11:25 +0000
Re: printing members of a structure jt@toerring.de (Jens Thoms Toerring) - 2015-02-27 11:31 +0000
Re: printing members of a structure bilsch <king621@comcast.net> - 2015-02-27 22:58 +0000
Re: printing members of a structure Keith Thompson <kst-u@mib.org> - 2015-02-27 08:20 -0800
Re: printing members of a structure bilsch <king621@comcast.net> - 2015-02-27 22:55 +0000
Re: printing members of a structure Barry Schwarz <schwarzb@dqel.com> - 2015-02-26 22:03 -0800
Re: printing members of a structure Chad <cdalten@gmail.com> - 2015-02-26 23:06 -0800
Re: printing members of a structure bilsch <king621@comcast.net> - 2015-02-27 08:23 +0000
Re: printing members of a structure Nick Bowler <nbowler@draconx.ca> - 2015-03-02 18:40 +0000
Re: printing members of a structure James Kuyper <jameskuyper@verizon.net> - 2015-03-02 14:28 -0500
Re: printing members of a structure Nick Bowler <nbowler@draconx.ca> - 2015-03-03 15:07 +0000
csiph-web