Bug in GCC / libstdc++: Space character categorized as non-printable by std::ctype<wchar_t>

ASSI Stromeko@nexgo.de
Sat Jul 27 06:58:20 GMT 2024


Kristian Spangsege via Cygwin writes:
> In C++, a space character is reported as non-printable by
> `std::ctype<wchar_t>` in the "C" locale (the only locale supported by
> `std::ctype`). In other words, the following expression evaluates to
> `false`:
>
>     ctype.is(std::ctype_base::print, ctype.widen(' '))
>
> where `ctype` is obtained by `std::use_facet<std::ctype<wchar_t>>(loc)` and
> `loc` is the "C" locale.
>
> It should have been evaluated to `true` because a space character is
> required by the C++ standard to be categorized as printable.
>
> Also, it is reported as printable by `std::iswprint(int ch)`.
>
> Also, the non-wide space character is reported as printable, i.e,
> `std::use_facet<std::ctype<char>>(loc)::is(std::ctype_base::print, ' ')` is
> `true`.
>
> Also, `ctype.is(std::ctype_base::print, ctype.widen(' '))` is `true` with
> MinGW, with GCC on Linux, and with Visual Studio.

This sounds like it might be a bug in newlib, so you should either
report it there or else it would be the newlib integration for gcc.  In
any case this needs to be fixed upstream.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra


More information about the Cygwin mailing list