This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51437] GCC should warn on the use of reserved identifier/macro names
- From: "potswa at mac dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 19 Feb 2012 11:09:28 +0000
- Subject: [Bug c/51437] GCC should warn on the use of reserved identifier/macro names
- Auto-submitted: auto-generated
- References: <bug-51437-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51437
--- Comment #11 from David Krauss <potswa at mac dot com> 2012-02-19 11:09:28 UTC ---
(In reply to comment #10)
> (In reply to comment #9)
> > However, note that the standards also reserve various other classes of names,
> > such as types ending in _t, for which GCC should only flag definitions, not
> > uses. Only system headers should define new _t types, but user code can *use*
> > types like time_t or pid_t without warning.
>
> These are only reserved for POSIX, and should not always be warned about!
Yes, respecting POSIX would be overkill. In particular, it's OK and common to
define such types in C++ outside the global namespace.
> > (Some of the other reserved identifier categories, such as E[A-Z0-9].*,
> > is[a-z].*, to[a-z].*, and mem[a-z].* should go under some separate, more
> > pedantic warning option.)
>
> I don't see why this should happen at all. There's nothing special about these
> general names?
See comment #3, they are reserved in C99 Â7.26 "Future library directions"
(although those patterns aren't quite right).