Marco Cimarosti writes:
> I hope this is not too much off topic.
>
> Time ago, Edmund Grimley Evans asked what should be the value of this
> expression:
>
> mbrtowc(&wc, "", 0, &ps)
>
> I have two other similar questions for cases that seems unspecified:
>
> 1) What should the function do when passed a NULL as the last argument?
> Should it use an internal mbstate_t variable or not?
Yes. The manpage says it:
In all of the above cases, if ps is a NULL pointer, a
static anonymous state only known to the mbrtowc function
is used instead.
> 2) What should it do and return if a mbstate_t is supplied that contains
> invalid state values
The same as may happen if you dereference an uninitialized char* variable:
unspecified behaviour. SIGSEGV or toast your cat.
Bruno
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/