RFC: mblen() return code when n is zero

Paul Eggert eggert@cs.ucla.edu
Mon Nov 17 16:23:00 GMT 2014


Rajalakshmi Srinivasaraghavan wrote:
> To get clarified on previous comments,What should mblen (mblen() calls
> __mbrtowc() internally)  return for the above testcase?

There was no "above testcase" in your email, but I suppose mblen and mbtowc 
should return -1 when given empty inputs, as in this case the leading bytes of 
the input buffer do not form a valid multibyte character.  Although POSIX 
doesn't say what errno value to use, EILSEQ doesn't seem appropriate here.  What 
errno values do other C libraries use?  I'd be guided by that.



More information about the Libc-alpha mailing list