Public Comment Number PC-UK0057 ISO/IEC CD 9899 (SC22N2620) Public Comment =========================================== Date: 1998-01-19 Author: Clive D.W. Feather Author Affiliation: Self Postal Address: Demon Internet Limited 322 Regents Park Road London N3 2QQ United Kingdom E-mail Address: Telephone Number: +44 181 371 1138 Fax Number: +44 181 371 1037 Number of individual comments: 1 Comment 1. Category: Normative change to intent of existing feature Committee Draft subsection: 7.13.2, 7.13.3, 7.19.3.10, 7.19.7 Title: Better locale handling for wide oriented streams Detailed description: 7.13.2p6 associates an /mbstate_t/ object with each stream, and 7.13.3p11-13 state that this is used with the various wide-oriented functions. On the other hand, 7.19.7p3 places very strict restrictions on the use of such objects, restrictions that cannot be met through the functions provided in the Standard while allowing convenient use of wide formatted I/O. Furthermore, an /mbstate_t/ object is tied to a single locale based on the first time it is used. This means that a wide oriented stream is tied to the locale in use the first time it is read or written. This will be surprising to many users of the Standard. Therefore, at the very least these objects should be exempt from the restrictions of 7.19.7; the restrictions of 7.13 (for example, 7.13.2p5 bullet 2) are sufficient to prevent unreasonable behaviour. In addition, the locale of the object should be tied and not affected by the current locale. The most sensible way to do this is to use the locale in effect when the file is opened, but allow /fwide/ to override this. In 7.13.2p6, add after the first sentence: This object is not subject to the restrictions on direction of use and of locale that are given in subclause 7.19.7. All conversions using this object shall take place as if the /LC_CTYPE/ category setting of the current locale is the setting that was in effect when the orientation of the stream was set with the /fwide/ function or, if this has not been used, when the stream was opened with the /fopen/ or /freopen/ function. In 7.19.3.10, add a new paragraph after paragraph 2: If the stream is successfully made wide oriented, the /LC_CTYPE/ category that is used with the /mbstate_t/ object associated with the stream shall be set to that of the current locale. In 7.19.7p3, append: These restrictions do not apply to the /mbstate_t/ objects associated with streams.