This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: wctomb dumps core on invalid input
- To: Bruno Haible <haible at ilog dot fr>
- Subject: Re: wctomb dumps core on invalid input
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 04 Dec 2000 15:43:14 -0800
- Cc: libc-alpha at sources dot redhat dot com
- References: <14891.39953.28983.108275@honolulu.ilog.fr>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
Bruno Haible <haible@ilog.fr> writes:
> According to SUSV2, "wctomb() returns -1 if the value of wchar does not
> correspond to a valid character". This is not what glibc 2.2 does. Here
> is a test program.
>
> ===========================================
> #include <wchar.h>
> #include <locale.h>
>
> int main ()
> {
> char buf[10];
> wchar_t wc = 0xdeadbeef;
There's a difference. The standard text refers to the character in
the multibyte encoding. If there is no equivalent to the wide
character -1 is returned.
A value like 0xdeadbeef for a wchar_t is completely impossible to get
since no module can produce it. The assumption that values of wchar_t
are <= 0x7fffffff must always be met.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------