Click here to Skip to main content
16,015,504 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: whats wrong with this? Pin
Christian Graus5-Apr-02 9:57
protectorChristian Graus5-Apr-02 9:57 
AnswerRe: whats wrong with this? Pin
Jon Hulatt5-Apr-02 5:51
Jon Hulatt5-Apr-02 5:51 
GeneralRe: whats wrong with this? Pin
Mazdak5-Apr-02 6:11
Mazdak5-Apr-02 6:11 
GeneralNetmessagebuffersend(): this is strange! Pin
Jörg Anslik4-Apr-02 21:42
Jörg Anslik4-Apr-02 21:42 
GeneralDirectShow StillCap problem Pin
Ruzicka4-Apr-02 21:37
Ruzicka4-Apr-02 21:37 
Generalbasic_string Pin
Niklas L4-Apr-02 21:37
Niklas L4-Apr-02 21:37 
GeneralRe: basic_string Pin
Niklas L4-Apr-02 21:39
Niklas L4-Apr-02 21:39 
GeneralRe: basic_string Pin
Joaquín M López Muñoz4-Apr-02 22:32
Joaquín M López Muñoz4-Apr-02 22:32 
The main reason why operator const E*() const was banned out of the standard is simply that too many people were againt them. There's a general suspicion about implicit conversions as the can make call to overload functions ambiguous and make the code less clear (allegedly). But the subject is somewhat controversial, and not everybody agrees with the resolution taken by the standard commitee. The example against operator const E*() const that I find most convincing is this: suppose the conversion operator actually exists, then the following piece of code works just fine:
void f(const char *)
{
...
}
...
string s1="Code";
string s2="Project";
f(s1+s2); //create a temporary (s1+s2) and pass its internal const char *
But the following snippet will fail, although it seems an innocent version of the former:
string s1="Code";
string s2="Project";
const char *p=s1+s2;
f(p);
The reason why this fails is that p is no longer valid because the temporary (s1+s2) according to the standard rules might have been deleted when the call to f comes. Introducing c_str does not prevent this problem, but at least make you think twice about it ((s1+s2).c_str() is an eye-catching sentence, isn't it.)


Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: basic_string Pin
Joao Vaz4-Apr-02 23:49
Joao Vaz4-Apr-02 23:49 
GeneralRe: basic_string Pin
Tim Smith5-Apr-02 3:48
Tim Smith5-Apr-02 3:48 
GeneralRe: basic_string Pin
Joao Vaz5-Apr-02 4:56
Joao Vaz5-Apr-02 4:56 
GeneralRe: basic_string Pin
Joaquín M López Muñoz5-Apr-02 5:40
Joaquín M López Muñoz5-Apr-02 5:40 
GeneralRe: basic_string Pin
Joao Vaz5-Apr-02 6:03
Joao Vaz5-Apr-02 6:03 
GeneralRe: basic_string Pin
Niklas L5-Apr-02 1:12
Niklas L5-Apr-02 1:12 
GeneralPLEASE HELP ME Pin
cycosi4-Apr-02 21:12
cycosi4-Apr-02 21:12 
GeneralRe: PLEASE HELP ME Pin
Mazdak4-Apr-02 21:27
Mazdak4-Apr-02 21:27 
GeneralRe: PLEASE HELP ME Pin
Christian Graus4-Apr-02 21:37
protectorChristian Graus4-Apr-02 21:37 
GeneralRe: PLEASE HELP ME Pin
cycosi4-Apr-02 22:41
cycosi4-Apr-02 22:41 
GeneralRe: PLEASE HELP ME Pin
Christian Graus4-Apr-02 22:58
protectorChristian Graus4-Apr-02 22:58 
GeneralRe: PLEASE HELP ME Pin
Tomasz Sowinski5-Apr-02 6:02
Tomasz Sowinski5-Apr-02 6:02 
GeneralVery Basic Question. Pin
Mazdak4-Apr-02 20:14
Mazdak4-Apr-02 20:14 
GeneralRe: Very Basic Question. Pin
Joaquín M López Muñoz4-Apr-02 20:28
Joaquín M López Muñoz4-Apr-02 20:28 
GeneralRe: Very Basic Question. Pin
Mazdak4-Apr-02 20:34
Mazdak4-Apr-02 20:34 
GeneralRe: Very Basic Question. Pin
Joaquín M López Muñoz4-Apr-02 20:44
Joaquín M López Muñoz4-Apr-02 20:44 
GeneralRe: Very Basic Question. Pin
Mazdak4-Apr-02 20:54
Mazdak4-Apr-02 20:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.