[libcxx-commits] [PATCH] D97870: [libc++] Add missing header <cuchar>

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 6 05:59:47 PDT 2021


ldionne added a comment.

I did something that we usually don't do here - I made the `<cuchar>` and `<uchar.h>` headers fail with an explicit error when included in C++03 mode. The rationale for doing that is that the headers won't work in C++03 mode (they require the `char16_t` type, which is in C++11), and I thought getting a clear error was better than getting a cryptic error about missing `char16_t` (or even worse, clashing with our broken attempt to provide `char16_t` in C++03 mode in `<__config>`).

Another approach would have been to render the header empty when used in C++03 mode. This is what we do elsewhere. However, I quite dislike this as a general approach because it hides the fact that the header shouldn't be used pre C++11. Users could rightfully file bugs against us for providing an empty `<cuchar>` header in C++03 mode. Instead, I thought providing an error message was more helpful and more in line with the "fail fast and in obvious ways" line of thinking.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97870/new/

https://reviews.llvm.org/D97870



More information about the libcxx-commits mailing list