3 ms·
From https://gcc.gnu.org/gcc-8/porting_to.html https://gcc.gnu.org/gcc-8/porting_to.html: > The alignof operator has been changed to return the minimum alignme
by earenndil 7y ago
From https://gcc.gnu.org/gcc-8/porting_to.html https://gcc.gnu.org/gcc-8/porting_to.html:
> The alignof operator has been changed to return the minimum alignment required by the target ABI, instead of the preferred alignment (consistent with _Alignof in C)
> Code which uses alignof to obtain the preferred alignment can use __alignof__ instead
So, there's an alignof and an __alignof__ function, which do similar but subtly different things? That sounds like a recipe for disaster.
- kanox 7y agoThis is extremely common? After all, what does __ signal if not "suble difference"?
- ComputerGuru 7y agoVendor-specific/non-standard?
- earenndil 7y agoDefinitely not 'subtle difference'; when has it ever meant that? It means a nonstandard extension.
- comex 7y agoGCC extensions in particular tend to support multiple spellings of the same keyword with different numbers of underscores, which usually do exactly the same thing. For example, you can write asm, __asm, or __asm__; typeof, __typeof, or __typeof__; __attribute or __attribute__; etc. The versions with no underscores only with with a setting of -std that includes GNU extensions, while the versions with underscores always work (because names starting with underscores are reserved by the spec). Even alignof has __alignof and __alignof__ as two spellings of the GNU variant. But unlike with typeof, for whatever reason, plain "alignof" was never supported in C as a GNU extension; it only ever worked in C++ mode, as a standard feature from C++11. That makes it slightly less weird to create a difference. But only slightly; I'm more familiar with GCC esoterica than most people and I had no idea "alignof" was C++-exclusive until I looked it up.
- cozzyd 7y agoThis will be annoying to someone whose struct dumps suddenly stop working.