3 ms·
Implementation-defined as far as I'm aware. If pointers with all bits zero actually represent null pointers, things will be fine. edit: I haven't found any sm
by cygx 6y ago
Implementation-defined as far as I'm aware. If pointers with all bits zero actually represent null pointers, things will be fine.
edit:
I haven't found any smoking gun quotation in the C11 standard on short notice, but there is footnote 296 (p.348) on calloc() zeroing all bits:
> Note that this need not be the same as the representation of floating-point zero or a null pointer constant.
Nothing about this being UB in cases where it does represent a null pointer constant.
- benhoyt 6y agoWow, thanks, I did not know that. Though that would be a kinda crazy platform or implementation! I'm betting that a lot of people depend on this.