Bug 31206 - Incorrect value for C-locale (mon_)grouping
Summary: Incorrect value for C-locale (mon_)grouping
Status: RESOLVED NOTABUG
Alias: None
Product: glibc
Classification: Unclassified
Component: manual (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-02 13:44 UTC by Oscar Gustafsson
Modified: 2024-01-02 14:11 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oscar Gustafsson 2024-01-02 13:44:46 UTC
The manual states:

"In the standard ‘C’ locale, both grouping and mon_grouping have a value of "". This value specifies no grouping at all."

However, the value is -1/CHAR_MAX

https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/locales/C;h=fc0614e551519c6b162379bf672b428dba21c12a;hb=refs/heads/master#l73

Not a big deal, but when trying to understand how it actually works, I stumbled upon this. Also, it is not mentioned earlier that an empty string should give this behavior, rather it says that when finding a string termination character, it should use the previous char.

Location of the incorrect statement:
https://sourceware.org/git/?p=glibc.git;a=blob;f=manual/locale.texi;h=f6afa5dc44a2a016df5c529dc8d2491b689f4b37;hb=HEAD#l702
Comment 1 Andreas Schwab 2024-01-02 14:11:22 UTC
There are two different representations of the same value:

- the locale source file uses (mon_)grouping -1
- the localeconv function sets the (mon_)grouping members to ""

See 7.3.3 LC_MONETARY and 7.3.4 LC_NUMERIC in the POSIX.1 standard.