Obviously the standard is broken/incorrect or your interpretation of it is 
broken/incorrect.

Most API headers do the same thing.  Even the standard library does it, in most 
compilers.  Not all of them add the trailing _, but several do.  Whether and 
particular one does or not seems to depend on whether the entropy of the 
multiverse was odd or even at the time the API was generated.

> -----Original Message-----
> From: sqlite-users-boun...@mailinglists.sqlite.org [mailto:sqlite-users-
> boun...@mailinglists.sqlite.org] On Behalf Of Daniel Seither
> Sent: Friday, 8 July, 2016 17:56
> To: sqlite-users@mailinglists.sqlite.org
> Subject: [sqlite] Bug: SQLite's include guards are reserved identifiers
> 
> Using clang 3.8 with -Wreserved-id-macro (enabled by -Weverything), I
> just noticed that SQLite uses include guards with a leading underscore,
> for example _SQLITE3_H_ in the amalgamation. According to the C
> standard, this is a reserved identifier, leading to undefined behavior:
> 
> > All identifiers that begin with an underscore and either an uppercase
> > letter or another underscore are always reserved for any use. [...]
> > If the program declares or defines an identifier in a context in
> > which it is reserved (other than as allowed by 7.1.4), or defines a
> > reserved identifier as a macro name, the behavior is undefined.
> 
> (Source: the C11 standard, Section 7.1.3, see [1] for the latest draft
> of C11 before publication, which should be identical to the finished text)
> 
> I guess that means that the include guards should be changed to no
> longer use leading underscores. Any opinions on that?
> 
> Daniel
> 
> [1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to