[libcxx-commits] [PATCH] D122532: Do not use non-POSIX strtoll_l and strtoull_l

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 28 12:22:19 PDT 2022


mstorsjo added a comment.

In D122532#3412113 <https://reviews.llvm.org/D122532#3412113>, @ldionne wrote:

> I don't really have strong push back per-se, however the fact that `strotoull_l` & friends exist seems to suggest that perhaps it's useful to have locale-dependent versions of those functions?
>
> @mstorsjo You've done some work related to locales, do you have an opinion on this?

Not much opinion - I didn't touch much of the implementation other than staring at test details... Offhand, from what I remember from some localization work ages ago, I think it's possible to express numbers with other unicode chars than the regular `'0' - '9'` (in Arabic/Farsi maybe, although I might misremember). So it's at least theoretically possible that a `strtoull_l`, with such a locale, could parse such a string (but it'd be nice to have an example), so that could be a reason for there existing such a function.

However, as @georgthegreat points out, this is only ever called with the `"C"` locale here, so then it should probably(?) be equivalent to just calling the plain `strtoull`. So I think this patch could be considered fine. But I don't feel super authoritative on the matter...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122532



More information about the libcxx-commits mailing list