This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

772. Impossible return clause in [string.conversions]

Section: 23.4.5 [string.conversions] Status: CD1 Submitter: Daniel Krügler Opened: 2008-01-13 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [string.conversions].

View all issues with CD1 status.

Discussion:

The return clause 23.4.5 [string.conversions] paragraph 15 of the new to_wstring overloads says:

Returns: each function returns a wstring object holding the character representation of the value of its argument that would be generated by calling wsprintf(buf, fmt, val) with a format specifier of L"%lld", L"%ulld", or L"%f", respectively.

Problem is: There does not exist any wsprintf function in C99 (I checked the 2nd edition of ISO 9899, and the first and the second corrigenda from 2001-09-01 and 2004-11-15). What probably meant here is the function swprintf from <wchar.h>/<cwchar>, but this has the non-equivalent declaration:

int swprintf(wchar_t * restrict s, size_t n,
const wchar_t * restrict format, ...);

therefore the paragraph needs to mention the size_t parameter n.

Proposed resolution:

Change the current wording of 23.4.5 [string.conversions] p. 15 to:

Returns: eEach function returns a wstring object holding the character representation of the value of its argument that would be generated by calling wsswprintf(buf, bufsz, fmt, val) with a format specifier fmt of L"%lld", L"%ulld", or L"%f", respectively, where buf designates an internal character buffer of sufficient size bufsz.

[Hint to the editor: The resolution also adds to mention the name of the format specifier "fmt"]

I also would like to remark that the current wording of it's equivalent paragraph 7 should also mention the meaning of buf and fmt.

Change the current wording of 23.4.5 [string.conversions] p. 7 to:

Returns: eEach function returns a string object holding the character representation of the value of its argument that would be generated by calling sprintf(buf, fmt, val) with a format specifier fmt of "%lld", "%ulld", or "%f", respectively, where buf designates an internal character buffer of sufficient size.