[libc-commits] [PATCH] D134074: [libc] add strerror

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Sep 20 14:45:13 PDT 2022


sivachandra added inline comments.


================
Comment at: libc/src/__support/error_to_string.cpp:226
+
+  constexpr cpp::string_view get_str(int err_num) const {
+    if (err_num >= 0 && static_cast<size_t>(err_num) < ERR_ARRAY_SIZE &&
----------------
There is no point making this method a constexpr and introducing the `const_convert` (that would in a way be an antipattern) method - the argument `err_num` is not going to be a `constexpr` so this function is always evaluated at runtime.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134074



More information about the libc-commits mailing list