Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [diff.basic]
Link to reflector thread (if any):
Issue description:
[basic.fundamental] p5 specifies that for an N-bit integer type, there're N binary coefficients contributing to the integer value. However, there's no direct relation between N constituent bits and these N coefficients specified by the C++ standard.
On the contrary, such relation is present in C, at least since C99. WG14 N691 bounded the binary coefficients to the bit values.
Per discussion in #912 (comment), such difference seems to be intended. Perhaps we should have entry in [diff.basic] for this.
E.g.
#include <stdint.h>
#include <string.h>
void f() {
int32_t n = {};
unsigned char buf[sizeof(int32_t)] = {};
bool b = memcmp(&n, &buf, sizeof(int32_t)) == 0; // guaranteed to be true in C, not guaranteed in C++
}
Suggested resolution:
Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [diff.basic]
Link to reflector thread (if any):
Issue description:
[basic.fundamental] p5 specifies that for an N-bit integer type, there're N binary coefficients contributing to the integer value. However, there's no direct relation between N constituent bits and these N coefficients specified by the C++ standard.
On the contrary, such relation is present in C, at least since C99. WG14 N691 bounded the binary coefficients to the bit values.
Per discussion in #912 (comment), such difference seems to be intended. Perhaps we should have entry in [diff.basic] for this.
E.g.
Suggested resolution: