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

2010-01-01 Thread Andy Koppe
> Some comments: > 1- I think that printf(string_constant) and printf(char_array) should give > the same > output in any circumstance. > 2- In absence of a call to setlocale printf((string_constant) writes > according to > the locale of the environment, but  printf(char_array)  does not, even > tho

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

2009-12-30 Thread Rodrigo Medina
Hi, Eric Blake on Dec 2009 06:41:33 wrote: >According to Andy Koppe on 12/29/2009 6:30 AM: >>> 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 disagre

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

2009-12-29 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Andy Koppe on 12/29/2009 6:30 AM: >> 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 w

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

2009-12-29 Thread Andy Koppe
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 va

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

2009-12-29 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Andy Koppe on 12/28/2009 11:17 PM: >>> I am using LC_ALL=es_VE.ISO-8859-15. So you told gcc which charset to use for those non-ASCII characters, which resulted in raw 8-bit bytes. puts is required to work transparently on bytes, but prin

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

2009-12-29 Thread Andy Koppe
2009/12/29 Rodrigo Medina: >>Ah, the problem actually is that your program is missing a call to >>setlocale(LC_CTYPE, "") to switch to the locale and character set >>specified in the environment... > > That worked!, but what that means is that if one wants to > use any locale other than C.UTF-8, on

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

2009-12-29 Thread Rodrigo Medina
>2009/12/28 Andy Koppe: >... >Ah, the problem actually is that your program is missing a call to >setlocale(LC_CTYPE, "") to switch to the locale and character set >specified in the environment... That worked!, but what that means is that if one wants to use any locale other than C.UTF-8, one has,

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

2009-12-28 Thread Andy Koppe
2009/12/28 Andy Koppe: > 2009/12/28 Rodrigo Medina: >> Hi, >> I am moving from cygwin-1.5 and gcc3.4 to cygwin1.7 and gcc4. >> Some simple programs of mine fail. >> >> I am using LC_ALL=es_VE.ISO-8859-15. >> >> I have reduced the problem to this example >> >> -- >> #include >> main() >

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

2009-12-28 Thread Andy Koppe
2009/12/28 Rodrigo Medina: > Hi, > I am moving from cygwin-1.5 and gcc3.4 to cygwin1.7 and gcc4. > Some simple programs of mine fail. > > I am using LC_ALL=es_VE.ISO-8859-15. > > I have reduced the problem to this example > > -- > #include > main() > { > static char* line1 = > " This l