Does main function Unicode?

  • Follow


Hi,

  Does main function support unicode?
int main( int argc, char** argv ) can I say int mainw( int argc,
wchar_t** argv )?

Thanks
Trupti
0
Reply Samant.Trupti (36) 8/7/2008 4:13:45 PM

Samant.Trupti@gmail.com wrote:
>   Does main function support unicode?
> int main( int argc, char** argv ) can I say int mainw( int argc,
> wchar_t** argv )?

The Standard doesn't have any unicode (or Unicode or UNICODE) support 
AFA main function is concerned, but the implementation (the compiler and 
the library) are allowed to provide whatever other variations of the 
main function they need.  The reason it's not in the Standard is that it 
would make no sense to require 'mainw' function on the systems that have 
no use for Unicode.

V
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
0
Reply v.Abazarov (13255) 8/7/2008 4:24:07 PM


On Aug 7, 6:13 pm, "Samant.Tru...@gmail.com" <Samant.Tru...@gmail.com>
wrote:
>   Does main function support unicode?
> int main( int argc, char** argv ) can I say int mainw( int argc,
> wchar_t** argv )?

With regards to the function signature, no.  Beyond that, any
Unicode support (including in wchar_t) is currently
implementation defined.  The implementations I use allow Unicode
(UTF-8) in the argv strings, but don't require it.  (The real
issue, of course, is where argv comes from.  Unix, for example,
allows everything but a '\0' character in each argv argument,
just copying whatever it is given by the program which invoked
your program.  Windows is a bit more complicated, but I think it
will work the same regardless of whether you pass UTF-8, 8859-1,
or some other ASCII based encoding---I *think* that it only
treats tab (0x09), space (0x20) and quotes (0x22) specially.)

--
James Kanze (GABI Software)             email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
0
Reply james.kanze (9594) 8/8/2008 8:42:50 AM

2 Replies
36 Views

(page loaded in 0.084 seconds)


Reply: