[libcxx-commits] [PATCH] D120088: [libcxx] Fix the error checking for wctob_l, fixing locale narrow function on Windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 25 13:45:12 PST 2022


mstorsjo added inline comments.


================
Comment at: libcxx/src/locale.cpp:1527
     int r = __libcpp_wctob_l(c, __l);
-    return r != static_cast<int>(WEOF) ? static_cast<char>(r) : dfault;
+    return r != static_cast<int>(EOF) ? static_cast<char>(r) : dfault;
 }
----------------
Quuxplusone wrote:
> mstorsjo wrote:
> > Quuxplusone wrote:
> > > I don't think the cast to `int` is doing anything anymore; what goes wrong if you remove it? Ditto below.
> > Sure, it should work just fine to drop the cast.
> Here and below, I'd now prefer parens
> `return (r != EOF) ? static_cast<char>(r) : dfault;`
> for clarity, although it's no big deal.
Ok, sure, will do. Yeah I prefer that form for clarity, too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120088



More information about the libcxx-commits mailing list