Closed pmetzger closed 5 years ago
Patch available in pull request #7
Actually, ISO C11 does require alignof
to be a keyword, while _Alignof
seems to be merely a GNU artifact.
The issue is that if I don't also declare _Alignof
as a keyword, then files preprocessed by gcc willhave alignof
replaced with _Alignof
because of the macro, and I will fail to parse them...
Actually, ISO C11 does require
alignof
to be a keyword, while_Alignof
seems to be merely a GNU artifact.
Not according to C11 draft N1570. See Section A.1.2 on page 459, among a number of places in the document. Also, the definition of stdalign.h
in section 7.15, page 268. I'm pretty sure _Alignof
is the real one; the policy has been never to introduce a new keyword without a leading _
in order to avoid breaking old code that might use a particular name as an identifier.
See: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
Ah, right. I was looking at n1548, which is different to that respect. Then, I'll merge your pull request.
I didn't realize that had been changed so late in the standards process. Interesting! I'll have to make sure that none of my own work was based on 1548 given the changes. BTW, drafts of c17/c18 are available, perhaps I should check for grammar changes...
The lexer recognizes "alignof", see:
I believe
alignof
is a macro defined in<stdalign.h>
and is not a language reserved word. It should probably not be recognized by the lexer as an alias for_Alignof
.