[omniORB] Problem of CORBA::String in MFC Application
Poilpret Jean Francois
jfpoilpret@hn.vnn.vn
Sat, 27 Nov 1999 07:41:40 +0700
According to the ISO C++ standard (section 2.13.4 "string literals", =
page 19), "a string literal has type "array of N const char", where N is =
the size of the string" (including '\0').
Therefore, it is implicitly casted to const char*.
The behavior of VC++ is non conforming.
Therefore, if you want portable code, you should prepend all your =
strings litterals with "const char*). This won't hurt with any compliant =
compiler.
Regards,
Jean-Fran=E7ois Poilpr=EAt
-----Original Message-----
From: Guy Trudel <gtrudel@mediatrix.com>
To: Omniorb-List (E-mail) <omniorb-list@uk.research.att.com>
Cc: 'Diego Roig' <diego.roig@grupoclave.com>
Date: samedi 27 novembre 1999 03:05
Subject: RE: [omniORB] Problem of CORBA::String in MFC Application
I always thought that string literals were <const char*> until few weeks =
ago
when I started testing OmniOrb 2.8=20
So with msdev compiler string literal are char*, so everyone using =
string
literal directly with string_var should be careful.
Does the C++ ansi standard reflect this ISO C++ compiler string literals
rules ? I have here the Annotated C++ Reference from Stroustrup (from =
april
1995) and it says that string literals are of type char[] and not const
char[] for compatibility with classic C. I hope this has changed, =
because
it makes more sense to be const char[]. You can email me directly (since
it's really not an omniorb question).=20
Thank you,
Guy Trudel