bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: %.1s format with vasnprintf reads more than one byte from argument


From: Bruno Haible
Subject: Re: %.1s format with vasnprintf reads more than one byte from argument
Date: Fri, 27 Feb 2009 01:27:48 +0100
User-agent: KMail/1.9.9

Eric Blake wrote:
> > +static wchar_t wstring[] = { 'a', 'b', 'c', 0 };
> 
> Are we guaranteed that on all platforms, 'a' promotes to L'a'?  Or should
> we explicitly write the latter?

It is guaranteed: ISO C 99 paragraph 7.17.(2) says:
  "wchar_t
   ... is an integer type whose range of values can represent distinct codes
   for all members of the largest extended character set speciļ¬ed among the
   supported locales; the null character shall have the code value zero and
   each member of the basic character set shall have a code value equal to its
   value when used as the lone character in an integer character constant."
The "basic character set" is defined in section 5.2.1.

In practice, btowc(x) == x for all x in the ASCII range (0 <= x < 128).

> Should we also test that %S serves as a synonym for %ls?

I'd say, it's not useful. %S is specified only in POSIX, not in ISO C99, and
the direvtives are equivalent. Users can use %ls.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]