typedef names
Karl Heuer
karl at haddock.ima.isc.com
Sat Jan 20 14:14:54 AEST 1990
In article <YZhuprK00Vsa4O07JO at andrew.cmu.edu> bader+ at andrew.cmu.edu (Miles Bader) writes:
>karl at haddock.ima.isc.com (Karl Heuer) writes:
>> Likewise, you should probably not use _t for your own typedefs, because
>> POSIX reserves this entire class for use in <sys/types.h>.
>
>Now that's an incredibly stupid thing to do, given the large number of people
>who already do use _t suffixes.
Well, let me rephrase it. If you're *not* using <sys/types.h>, then you're
safe; there are only a finite number of _t names reserved outside of that
header (e.g. size_t). If you *are* using <sys/types.h> in a program intended
to be portable, then you'd better not use any of the _t namespace, because the
implementation is permitted to have nonstandard extensions visible as long as
they use that spelling. (E.g., ushort_t.)
I think this is better than the old method, where there was no guarantee at
all about the namespace of <sys/types.h>, and one vendor would typedef ushort
while another would do u_short, the end result being that both names are
reserved and neither is usable.
Karl W. Z. Heuer (karl at haddock.isc.com or ima!haddock!karl), The Walking Lint
More information about the Comp.lang.c
mailing list