Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jun 2009 01:09:02 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Gabor Kovesdan <gabor@FreeBSD.org>
Cc:        freebsd-standards@FreeBSD.org
Subject:   Re: mbstowcs() contradiction
Message-ID:  <20090601230902.GA47172@stack.nl>
In-Reply-To: <4A244D7A.9040508@FreeBSD.org>
References:  <4A244D7A.9040508@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 01, 2009 at 11:51:54PM +0200, Gabor Kovesdan wrote:
> I've just found a contradiction in the mbstowcs() man page. It says:
> "The mbstowcs() function returns ........  or -1 if an invalid multibyte 
> character was encountered."

> It is impossible, because its return value is size_t, which is a signed 
> type. Looking on the online documentaton, I think it should return 
> (size_t)-1 on error. I've also looked at the code and I think our 
> implementation is standard-compliant, but could someone take another 
> look, please? If someone can acknowledge I'm right, I'll update the man 
> page.

Apart from the fact that size_t is an unsigned type, that is correct.
The function returns (size_t)-1 on error.

On another note, the XSI extension of allowing a NULL destination
pointer to find the length seems to be implemented but is not
documented. The EILSEQ errno is also an XSI extension.

-- 
Jilles Tjoelker



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