Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2012 16:55:15 +0400
From:      Sergey Kandaurov <pluknet@gmail.com>
To:        David Demelier <demelier.david@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: mbstowcs(3) may not return -1
Message-ID:  <CAE-mSO%2B3MArm6CJEtzuuTA=-Q_zcUGawnWaaPNZzi7PpQT1VnQ@mail.gmail.com>
In-Reply-To: <4FE315B6.9020102@gmail.com>
References:  <4FE315B6.9020102@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 21 June 2012 16:38, David Demelier <demelier.david@gmail.com> wrote:
> Hello,
>
> While reading the manpage of mbstowcs I noticed an error in the RETURN
> VALUES :
>
> =A0 =A0 The mbstowcs() function returns the number of wide characters con=
verted,
> =A0 =A0 not counting any terminating null wide character, or -1 if an inv=
alid
> =A0 =A0 multibyte character was encountered.
>
> Since size_t is unsigned, it can't returns -1.

It returns (size_t)(-1).
I don't know how is it correct, but this conforms to C spec.

--=20
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSO%2B3MArm6CJEtzuuTA=-Q_zcUGawnWaaPNZzi7PpQT1VnQ>