Re: mbstowcs(3) may not return -1

From: Garrett Wollman <wollman_at_hergotha.csail.mit.edu>
Date: Thu, 21 Jun 2012 15:44:57 -0400 (EDT)
In article <4FE340FF.80406_at_gmail.com>, demelier.david_at_gmail.com writes:
>On 21/06/2012 14:55, Sergey Kandaurov wrote:
>> It returns (size_t)(-1).
>> I don't know how is it correct, but this conforms to C spec.

>Mm, if I understand well, since it is cast to size_t, I think the return 
>value will be SIZE_MAX - 1 then, right?

No.  C does not make any such equivalence.  "(size_t)-1" is the one
correct spelling of this value (modulo redundant additional
parentheses), and that's how the standard writes it.

-GAWollman
Received on Thu Jun 21 2012 - 17:44:58 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:28 UTC