Talk:c/string/multibyte/c32rtomb
From cppreference.com
< Talk:c | string/multibyte
[edit] Example
Two questions: 1) The example does not mention "Powered by Coliru online compiler." Is this an oversight or is there a reason not to mention it here? 2) Is there any value in mentioning in the example that the Coliru compilers which run the example actually define __STDC_UTF_32__ and therefore the example really is using UTF-32? In other words should the following be added:
#ifdef __STDC_UTF_32__
printf("__STDC_UTF_32__ defined\n");
#else
printf("__STDC_UTF_32__ not defined\n");
#endif
Newatthis (talk) 05:45, 18 January 2017 (PST)
- I see "Powered by Coliru online compiler" when I click Run, same as everywhere else. Seeing as there isn't (and almost surely not going to be) an implementation that puts something other than UTF-32 in char32_t, I don't think it's important enough to spend five lines of the example on. If it worries you too much, an assert would do it. It's more practically useful to assert that setlocale worked to guard against incomplete libcs (such as the one on Windows), or just mark the output as "possible" (
p=true) to account for that possibility. --Cubbi (talk) 06:24, 18 January 2017 (PST)