https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119011
--- Comment #27 from Alejandro Colomar <[email protected]> --- (In reply to Vincent Lefèvre from comment #26) > (In reply to Alejandro Colomar from comment #25) > > I think the design of mbrtowc(3) could be improved. It could have set errno > > to something different (maybe EINPROGRESS instead of returning -2?). > > EINPROGRESS has a different meaning. But anyway, mbrtowc is already > standardized in ISO C. And forcing to use errno while a return code is > sufficient is a bad idea. > > IMHO, such return codes should have names, so that instead of comparing with > literals -1 or -2, one could compare with these names. This would also > improve the code readability. Yup, this would solve the issue with -2, so we could go back to the original idea of excepting only unsuffixed literal -1. Another alternative would be to change mbrtowc(3) to return a ssize_t. That would be a breaking change for function pointers, but it might be doable. The main problem is that the C Committee refuses to standardize ssize_t.
