Click here to Skip to main content
15,905,563 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralQuestions About CHtmlView and A Web Browsing Program Pin
jdnx5-Aug-05 0:17
jdnx5-Aug-05 0:17 
GeneralRe: Questions About CHtmlView and A Web Browsing Program Pin
jdnx6-Aug-05 1:31
jdnx6-Aug-05 1:31 
Generalk8062d.dll Pin
Member 20880665-Aug-05 0:10
Member 20880665-Aug-05 0:10 
GeneralRe: k8062d.dll Pin
Marc Soleda5-Aug-05 0:22
Marc Soleda5-Aug-05 0:22 
GeneralRe: k8062d.dll Pin
5-Aug-05 0:30
suss5-Aug-05 0:30 
GeneralRe: k8062d.dll Pin
eli150219795-Aug-05 1:48
eli150219795-Aug-05 1:48 
Generaltocxx... plz explain Pin
Eytukan5-Aug-05 0:08
Eytukan5-Aug-05 0:08 
GeneralRe: tocxx... plz explain Pin
toxcct5-Aug-05 0:23
toxcct5-Aug-05 0:23 
no, you didn't understand...

i said THIS won't work :

char* first  = "first";
char* second = "second";
CString str = first + second;


there is somewhere in the standard headers some operators defined, and especially two ones that are similar than the following :
const CString& operator + (LPCTSTR, const CString&);
const CString& operator + (const CString&, LPCTSTR);

so, for that to work, the operator must have one of its 2 operands of type CString.

let's expose what's going on what's going on when writing CString str = CString(first) + second;
1. Declaring <code>str </code>as a <code>CString </code>object.
2. seeing the <code>operator=()</code> the compiler evaluates the right part of the <code>=</code>
3. <code>CString(first)</code> call explicitely a constructor of the CString class that
     get a LPCTSTR (or <code>const char*</code> - it is the same).
4. seeing the <code>operator+()</code>, the compiler searches for an operator + that
     have the matching operand type (before trying an implicit cast). Happily, this
     operator + exist (see what i previously said on the global operators). it so calls is.
5. affects the CString that result from the + operation into <code>str</code>


understand better now, or may i have to explain what's going on too when using + between 2 char* ?



TOXCCT >>> GEII power
[toxcct][VisualCalc]
GeneralRe: tocxx... plz explain Pin
Eytukan5-Aug-05 0:33
Eytukan5-Aug-05 0:33 
GeneralRe: tocxx... plz explain Pin
toxcct5-Aug-05 0:55
toxcct5-Aug-05 0:55 
General*Off Topic...* Pin
toxcct5-Aug-05 2:45
toxcct5-Aug-05 2:45 
GeneralRe: *Off Topic...* Pin
Eytukan5-Aug-05 3:37
Eytukan5-Aug-05 3:37 
GeneralRe: *Off Topic...* Pin
toxcct5-Aug-05 3:39
toxcct5-Aug-05 3:39 
GeneralRe: *Off Topic...* Pin
ThatsAlok5-Aug-05 23:59
ThatsAlok5-Aug-05 23:59 
GeneralRe: *Off Topic...* Pin
toxcct6-Aug-05 0:22
toxcct6-Aug-05 0:22 
GeneralExpression Evaluation urgent in c/c++ Pin
uma_kanth_k5-Aug-05 0:05
uma_kanth_k5-Aug-05 0:05 
GeneralRe: Expression Evaluation urgent in c/c++ Pin
toxcct5-Aug-05 0:11
toxcct5-Aug-05 0:11 
GeneralRe: Expression Evaluation urgent in c/c++ Pin
uma_kanth_k5-Aug-05 1:44
uma_kanth_k5-Aug-05 1:44 
GeneralRe: Expression Evaluation urgent in c/c++ [edit] Pin
toxcct5-Aug-05 1:48
toxcct5-Aug-05 1:48 
JokeRe: Expression Evaluation urgent in c/c++ [edit] Pin
peterchen5-Aug-05 3:11
peterchen5-Aug-05 3:11 
GeneralRe: Expression Evaluation urgent in c/c++ Pin
toxcct5-Aug-05 3:16
toxcct5-Aug-05 3:16 
GeneralRe: Expression Evaluation urgent in c/c++ Pin
toxcct5-Aug-05 3:41
toxcct5-Aug-05 3:41 
GeneralRe: Expression Evaluation urgent in c/c++ Pin
peterchen5-Aug-05 10:54
peterchen5-Aug-05 10:54 
GeneralRe: Expression Evaluation urgent in c/c++ Pin
toxcct6-Aug-05 0:11
toxcct6-Aug-05 0:11 
GeneralRe: Expression Evaluation urgent in c/c++ Pin
ThatsAlok5-Aug-05 20:50
ThatsAlok5-Aug-05 20:50 

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.