[libcxx-commits] [PATCH] D128577: [libc++][chrono] Implements formatter day.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 26 09:48:16 PDT 2022


ldionne added inline comments.


================
Comment at: libcxx/include/__chrono/formatter.h:51
+_LIBCPP_HIDE_FROM_ABI tm __make_tm(const _Tp& __value) {
+  tm __result{
+      .tm_sec   = 0,
----------------
vitaut wrote:
> You could make this more robust and shorter:
> 
> ```
> tm __result = tm();
> #ifdef __GLIBC__
> __result.tm_zone = "UTC";
> #endif
> ```
> 
I think it might be important to use ` = tm()` to get proper zero initialization, otherwise some members might be left uninitialized.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128577



More information about the libcxx-commits mailing list