Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2012 15:44:57 -0400 (EDT)
From:      Garrett Wollman <wollman@hergotha.csail.mit.edu>
To:        demelier.david@gmail.com
Cc:        , current@freebsd.org
Subject:   Re: mbstowcs(3) may not return -1
Message-ID:  <201206211944.q5LJivlo053021@hergotha.csail.mit.edu>
In-Reply-To: <4FE340FF.80406@gmail.com>
References:  <4FE315B6.9020102@gmail.com> <CAE-mSO%2B3MArm6CJEtzuuTA=-Q_zcUGawnWaaPNZzi7PpQT1VnQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <4FE340FF.80406@gmail.com>, demelier.david@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206211944.q5LJivlo053021>