Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Implementing strstr
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Keith Thompson, post: 4049848"] Hmm. I don't remember making that particular point. Looking through the gcc documentation ("info gcc"), I don't see any mention of padding bits. It says that "all bit patterns are ordinary values" for signed types, but it doesn't say so for unsigned types (including _Bool). Note that the existence of padding bits doesn't imply the existence of trap representations. For example, I think any of the following would be a valid implementation; 1. _Bool has 8 bits, of which 1 is a value bit and the other 7 are padding bits. 1a. A representation with any padding bit set to 1 is a trap representation. 1b. Padding bits are ignored; only the single value bit contributes to the value. For example, after using memset to copy the byte values 0x00 and 0xf0 into two _Bool objects, the "==" operator will report that their values are equal. 2. _Bool has 8 bits, all of which are value bits. Case 2 can be treated as 1a depending entirely on the implementation's documentation; it's just a matter of which behavior the implementation chooses to leave undefined. If _Bool has more than 1 value bit, then yes. If _Bool has just 1 value bit, then no. Given a straightforward implementation (_Bool is 1 byte, conversions perform whatever extra work is needed to satisfy the standard's requirements, examining the value of a _Bool object just treats the representation as an unsigned byte), the implementation may document either 1 or 8 as the number of value bits. I think. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Implementing strstr
Top