C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Des jeux de caractères en C/C++ (repost)

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
Benoit SIBAUD
Guest





PostPosted: Mon Oct 17, 2005 9:52 am    Post subject: Des jeux de caractères en C/C++ (repost) Reply with quote



Bonjour,

l'effet des jeux de caractères en C/C++ peut se faire à plusieurs niveaux :
- d'abord le jeu de caractères du code source lui-même
- ensuite l'interprétation par le préprocesseur [1]
- l'interprétation du langage (sachant que les identifiants sont en
ASCII, elle se limite aux chaînes de caractères (chaînes C, string ou
wstring)
- l'interprétation du compilateur (GCC ne fait rien sur le sujet si je
ne m'abuse)
- l'interprétation à l'affichage (locales)

Exemple rapide : std::cout << "ûéèàç" << std::endl;

LocalesChaîne ISO-8859-15 UTF-8
ISO-8859-15 ûéèàç ûéÚà ç
UTF-8 non imprimable ûéèàç

[1] quelqu'un saurait-il ce que prévoit la norme sur le sujet ?
(ici gcc = GNU GCC 4.0.0
djgpp = http://www.delorie.com/djgpp/compile/compile.cgi/program.exe
comeau = http://www.comeaucomputing.com/tryitout/)

#define û u
void û() {}
int main() { û(); }

gcc: macro names must be identifiers
djgpp: Internal compiler error: program cpp got fatal signal 11
comeau: error: expected an identifier

#define fû u
void fû() {}
int main() { fû(); }

gcc (avec -E): warning: missing whitespace after the macro name
i586-pc-msdosdjgpp-gcc: Internal compiler error: program cpp got fatal
signal 11
comeau (avec -E): pas d'avertissement ni d'erreur
Avec un résultat étrange pour gcc et comeau:
void û uû() {}
int main() { û uû(); }

--
Benoît Sibaud
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.