This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc4[1.7] printf treats differently a string constant and a character array


2009/12/29 Eric Blake:
>> I couldn't find specific text about invalid bytes in the POSIX printf
>> spec,
>
> http://www.opengroup.org/onlinepubs/9699919799/functions/fprintf.html
>
> "all forms of fprintf() shall fail if:
>
> [EILSEQ]
> Â Â[CX] A wide-character code that does not correspond to a valid
> character has been detected."

The issue wasn't with wide characters, but invalid multibyte chars.
But anyway, we're agreed that printf is right to bail out.


> Remember, POSIX states that any use in a character context of bytes with
> the 8th-bit set is specifically undefined in the C locale (whether that be
> C.ASCII or C.UTF-8).

I very much disagree with that. C.ASCII and C.UTF-8 are different
locales from plain "C", and the whole point of the explicitly stated
charset is to define the meaning of bytes beyond 7-bit ASCII.

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]