[libc-commits] [PATCH] D74021: Created uChar implementation for libc

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Mar 23 01:06:15 PDT 2020

sivachandra added a comment.

Sorry it took me this long to comment here. Part of it was because I had to educate myself about mutli-byte characters and wide characters. Few high level questions:

1. Are the functions `char[16|32]rtomb` doing a UTF-16|32 to UTF-8 conversion? Per the standard, they should convert to the current locale? May be UTF-8 is an acceptable target encoding. In which case, should we have an error reporting scheme when the locale is not set to UTF-8?
2. You mention building multi-byte support over wide char support. However, if I am reading it right, it doesn't seem like it?

A generic comment: I think you are not using pointers correctly. For example, in the `mbrtoc16` function, you have this:

  if ((s & 0x80) == 0) {
      // ASCII
  } else if ((s & 0x80) == ) 

`s` is of type `const char *restrict`. Seems to me like that the intention here is to compare first the character `*s`?

In few other places, I see incomplete code. Is the patch ready for review?



More information about the libc-commits mailing list