Re:GCC 13 Supports New C2x Features, Including Nullptr, Enha...
by pjmlp on Tuesday May 16, 2023 @01:05AM
(#35957919)
Yeah, but all of that falls off ISO C defined semantics.
[ Parent
| on HN ]
Re:GCC 13 Supports New C2x Features, Including Nullptr, Enha...
by mananaysiempre on Tuesday May 16, 2023 @08:03AM
(#35960630)
Incidentally, AFAICT C23 now allows stashing log2 alignof(max_align_t) bits in pointers in a portable (if awkward) manner: for example, for a char pointer p, the lowest such bit can be retrieved with memalignment(p)<2 and masked off with p-(memalignment(p)<2).
(C++’s std::aligned would be less awkward, but, well, memalignment() is what we get.)
You still can’t portably store pointers and integers (or doubles) in the same place and distinguish them, though.