svn commit: r206687 - head/usr.bin/indent

Bruce Evans brde at optusnet.com.au
Fri Apr 16 12:49:52 UTC 2010


On Fri, 16 Apr 2010, Colin Percival wrote:

> Bruce Evans wrote:
>> On Thu, 15 Apr 2010, Andriy Gapon wrote:
>>>  It seems that identifier "_t" is sometimes used as a variable name,
>>>  even in our tree. [...]
>>
>> Funny.  POSIX reserves "_t" as a suffix in header files, so unless it
>> also requires a non-null prefix, "_t" is reserved in POSIX.
>
> I think you must be reading a different version of POSIX to me.  My version says
> that symbols ending with "_t" may be defined in any header; but not that they
> cannot be used in non-headers.

No, it seems to be almost the same version, but my reading is more
lawerly :-).  I looked mainly at POSIX.1-1996.  They are reserved if
any POSIX header is included.  I thought that they were reserved only
for typedefed names, but can't see any restriction in the 1996 version.

Whether they can be used in a non-header that includes a POSIX header
depends on scope rules.  They can't be used at file scope for obvious
reasons.  If they are only reserved for typedefed names, then they can
be used for other names in inner scope, provided you compile with a C
compiler (no -Wshadow -Werror).  If they are reserved for any use,
then it is hard to think of any valid use in a non-header.  Uses like
"auto int foo_t;"  would fail if foo_t were a macro which expands to
almost anything.

Bruce


More information about the svn-src-all mailing list