home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,746 of 33,346   
   Alf P. Steinbach to Mathias Gaunard   
   Re: Nana, a free C++ GUI library, v0.1.1   
   19 Dec 11 00:44:33   
   
   95f85f4f   
   From: alf.p.steinbach+usenet@gmail.com   
      
   On 19.12.2011 03:56, Mathias Gaunard wrote:   
   >   
   > What do wide string literals have to do with Unicode?   
      
   In C++98/03, wide string literals make it possible to express literals   
   containing international characters, for a compiler that does not   
   support a Unicode-based narrow C++ execution character set.   
      
   One example of such a compiler is Microsoft's very popular Visual C++,   
   which has (undocumented, alas!) Windows ANSI as its C++ execution   
   character set, where "Windows ANSI" is the Windows codepage reported by   
   the Windows API GetACP() function.   
      
   This means that if you encode your source code as e.g. UTF-8, when you   
   inform Visual C++  about it (which is done by including a BOM at the   
   start of the file), it translates your narrow literals to Windows ANSI,   
   its execution character set, thereby in general losing information, and   
   warning you about each and every character where this happens... :-)   
      
   As of Visual C++ 10.0 you can trick that compiler by not informing it   
   that the source code is UTF-8, but then in a sense wide literals play   
   the opposite rôle, namely as hindrance instead of help: they're then   
   incorrectly assumed to be expressed in Windows ANSI, for their   
   translation to UTF-16.   
      
   In C++11 one might instead use Unicode literals. However, they are not   
   yet supported by the compiler mentioned above, at its version 10 and 11.   
   And the existence of this compiler means that there can be others (in   
   particular, I suspect that Intel's compiler behaves much the same).   
      
   This does not mean that literals need to be wide in all portable source.   
      
   But it does not mean that after preprocessing, for portable source the   
   literals need to be wide for those compilers that have non-Unicode based   
   narrow C++ execution character sets, such as currently Visual C++.   
      
      
   Cheers & hth.,   
      
   - Alf   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca