[libcxx-commits] [PATCH] D99091: [locale][num_get] Improve Stage 2 of string to float conversion

Tomas Matheson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 7 10:16:42 PDT 2021


tmatheson marked 4 inline comments as done.
tmatheson added inline comments.


================
Comment at: libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp:57
+    TEST("inf", 3, INFINITY, ios.goodbit | ios.eofbit);
+    TEST("INFINITY", 8, INFINITY, ios.eofbit | ios.goodbit);
+
----------------
Quuxplusone wrote:
> `INFxyz`, `INFinity`, `INFinite`, `INFiNiTy`
Added INFxyz and some crazy casing for INF.

It is worth noting that (by my reading of the standard, at least) `INFinite` is required to fail because:

* Stage 1 will select `%g` as the format specifier
* Stage 2 will keep consuming characters until it reaches the `'e'`, which is the first character that is not valid at that point in the sequence
* Stage 3 will then try to process the strong `"INFinit"` and should only process the first 3 characters (`INF`). Therefore the whole string will not be read, and `num_get` should return 0.0 with `failbit`

I suggest we save that discussion for the INFINITE PR though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99091



More information about the libcxx-commits mailing list