From: Marc on 3 Jun 2010 17:01 rebelde wrote: [Sun Studio in standard-compliant mode] >> gcc -std=c99 -pedantic is the equivalent. Does gcc -ansi work? > But gives also 17 byte for %-16.16s in case of a UTF-8 char: I don't have any solaris at hand to check, but IIRC "standard mode" is enabled by having a global variable: int __xpg4=1; in your program (not that you should do it yourself, the compiler should pass some appropriate ..o to the linker).
From: rebelde on 4 Jun 2010 04:13 Marc wrote: > rebelde wrote: > > [Sun Studio in standard-compliant mode] >>> gcc -std=c99 -pedantic is the equivalent. > > Does gcc -ansi work? > >> But gives also 17 byte for %-16.16s in case of a UTF-8 char: > > I don't have any solaris at hand to check, but IIRC "standard mode" is > enabled by having a global variable: int __xpg4=1; in your program (not > that you should do it yourself, the compiler should pass some appropriate > .o to the linker). Having int __xpg4=1; in my source, it works: $ fgrep xpg4 str.c int __xpg4=1; $ gcc -ansi str.c $ LC_ALL=de_DE.UTF-8 ./a.out strlen of buf with ascii char 16 [a ] strlen of buf utf char 16 [� ] $ gcc str.c $ LC_ALL=de_DE.UTF-8 ./a.out strlen of buf with ascii char 16 [a ] strlen of buf utf char 16 [� ] Using only -ansi does not work either Thanks for the trick. Matthias -- Matthias Apitz t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211 e <guru(a)unixarea.de> - w http://www.unixarea.de/ Solidarity with the zionistic pirates of Israel? Not in my name! �Solidaridad con los piratas sionistas de Israel? �No en mi nombre!
First
|
Prev
|
Pages: 1 2 Prev: SRC/P hardware RAID controller drivers Next: Solaris 10 Basic Install question |