[PATCH] Re: Your addition of BT_SSIZE

Zack Weinberg zack@codesourcery.com
Tue Aug 19 18:48:00 GMT 2003


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> | 
> | It's only simpler if you think that such a target will eventually turn
> | up.  If you think, as I do, that no such target will ever turn up,
> | then making the distinction just adds complexity to no benefit.
>
> I prefer preventing silent miscompilation rather than making the
> assumption you're making, even if it would turn out that we'd be too
> conservative.  Seperate abstractions should be separately represented.

No, they shouldn't.  Not when there is no difference corresponding to
the distinction.

You need to think about the practical situation as well as the formal
text of the relevant standard.  ssize_t is used for the return value
of system calls that would return size_t if they didn't need to return
-1 for an error indicator.  The actual range of their return values is
[-1, SIZE_MAX-1] -- if that type could be described accurately in C
that would be what ssize_t was.  The normal use of such is to compare
against -1, then convert to size_t; for that to work properly ssize_t
has to be the signed type corresponding to size_t.  Therefore the
possibility that ssize_t will be something else is an illusion, and
making a distinction in the compiler is pointless.

zw



More information about the Gcc-patches mailing list