J
Joshua Maurice
[...]> However, nothing requires that size_t is a typedef name. Howeveragain, the recommended practice according to the C standard is that
size_t is defined as a typedef, see 7.17 Common definitions
<stddef.h> / 4.
[...]
I've read 7.17p4 several times. This is the second time you've
made this claim, and it just isn't true
(It's worth noting that that paragraph does not exist in the C99
standard; it was added by one of the Technical Corrigenda, and
appears in N1256, which is close enough.)
But that paragraph does not mention "typedef", nor does the word
"typedef" appear anywhere in 7.17. (In fact, the *only* occurrences
of the word "typedef" in section 7 are in 7.18, (<stdint.h>),
and in 7.26.8, which refers to <stdint.h>.)
Here's 7.17p4:
The types used for size_t and ptrdiff_t should not have an
integer conversion rank greater than that of signed long int
unless the implementation supports objects large enough to make
this necessary.
That's just about *which* types should be used; it neither says or
implies anything about using typedef that wasn't already implied
by the previous paragraphs.
7.17p1 says "The following types ... are defined", and 6.7.7, which
describes typedef, is titled "Type definitions". And if that's not
enough to imply the use of typedef, there is no other construct in
standard C that could define wchar_t, ptrdiff_t, and size_t in a way
that would satisfy the requirements. (#define wouldn't do the job;
strictly conforming code may use those identifiers in inner scopes.)
Yes, the types "defined" in <stddef.h> are almost certainly typedefs.
No, paragraph 4 doesn't recommend that.
Ok. I can go with that.