Click here to Skip to main content
15,918,177 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Critical Section problems... Pin
HintiFlo23-Jan-02 1:12
HintiFlo23-Jan-02 1:12 
QuestionHow to set a bitmap as a dialog background ? Pin
adara26-Oct-01 4:58
adara26-Oct-01 4:58 
AnswerRe: How to set a bitmap as a dialog background ? Pin
Joaquín M López Muñoz26-Oct-01 5:48
Joaquín M López Muñoz26-Oct-01 5:48 
Generalthanx Pin
adara26-Oct-01 12:19
adara26-Oct-01 12:19 
Generaloverload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 4:46
Patrick D Owens26-Oct-01 4:46 
GeneralRe: overload resolution in VC 6.0 Pin
Chris Losinger26-Oct-01 4:55
professionalChris Losinger26-Oct-01 4:55 
GeneralRe: overload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 5:16
Patrick D Owens26-Oct-01 5:16 
GeneralRe: overload resolution in VC 6.0 Pin
Joaquín M López Muñoz26-Oct-01 6:53
Joaquín M López Muñoz26-Oct-01 6:53 
Amusing problem! First, your line (3) is probably not the same as (2), but rather a very different expression that by chance happens to compile. If I'm right, the compiler interprets it as a call to unary operator + applied to strTemp1, lTemp1, which in turn is parsed as the sequencing operator , applied to strTemp1 and lTemp1. In a nutshell, (3) is parsed as:
strTemp2 = +(strTemp1, lTemp1) // apply operator , to yield:
strTemp2 = +(lTemp1);          // apply unary operator + (idempotent for longs) to yield:
strTemp2 = lTemp1;             // apply user defined conversion from long to PString
For this analysis to hold water, some conversion from long to PString must exist. Otherwise I'm wrong (please confirm this). You can also check this hypothesis simply by printing out the result of (3) and seeing if it corresponds to the "stringed" value of lTemp1.

Then, if (3) actually is ruled out, we are left with solving the riddle of (4) compiling fine and (2) producing a C2666 error. IMHO, the only way for (4) not being equivalent to (2) is that your addition operators are defined in a namespace other than the global namespace, and the :: in ::operator + is making the difference by narrowing the set of addition operators applicable. Again, you're the one who can confirm or deny this.

So, if (3) and (4) give no error for the reasons I said (which I'm far from sure), then probably (2) fails legally to compile due to an overabundance of applicable operators and conversion. See this Microsoft article for an analysis of a problem resembling yours.

Why VC++ 5.0 compiled fine and 6.0 complains? Well, maybe is 6.0 being more standard compliant with respect to Koening lookup, who knows.

As you see, this is just a chain of speculations. Some of them you can easily check out (please inform back).
Also, I suggest you post this problem to comp.lang.c++.moderated for more authoritative opinions.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: overload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 9:16
Patrick D Owens26-Oct-01 9:16 
GeneralFilling CListCtrl from dll problem... Pin
26-Oct-01 4:39
suss26-Oct-01 4:39 
GeneralRe: Filling CListCtrl from dll problem... Pin
Joaquín M López Muñoz26-Oct-01 7:27
Joaquín M López Muñoz26-Oct-01 7:27 
GeneralAligning text Pin
Andrew Stampor26-Oct-01 3:57
Andrew Stampor26-Oct-01 3:57 
General2-d Graphics Pin
Chambers26-Oct-01 3:52
Chambers26-Oct-01 3:52 
GeneralRe: 2-d Graphics Pin
Remi Morin26-Oct-01 8:33
Remi Morin26-Oct-01 8:33 
GeneralRe: 2-d Graphics Pin
Christian Graus26-Oct-01 11:04
protectorChristian Graus26-Oct-01 11:04 
GeneralRe: 2-d Graphics Pin
Chambers27-Oct-01 0:07
Chambers27-Oct-01 0:07 
GeneralRe: 2-d Graphics Pin
Christian Graus27-Oct-01 0:32
protectorChristian Graus27-Oct-01 0:32 
GeneralON_UPDATE_COMMAND_UI problem... Pin
Remi Morin26-Oct-01 3:50
Remi Morin26-Oct-01 3:50 
GeneralRe: ON_UPDATE_COMMAND_UI problem... Pin
Tomasz Sowinski26-Oct-01 4:01
Tomasz Sowinski26-Oct-01 4:01 
GeneralRe: ON_UPDATE_COMMAND_UI problem... Pin
Chambers26-Oct-01 4:08
Chambers26-Oct-01 4:08 
GeneralRe: ON_UPDATE_COMMAND_UI problem... Pin
Carlos Antollini26-Oct-01 4:12
Carlos Antollini26-Oct-01 4:12 
GeneralRe: ON_UPDATE_COMMAND_UI problem... Pin
Carlos Antollini26-Oct-01 4:17
Carlos Antollini26-Oct-01 4:17 
GeneralDate and Time Picker Control Pin
Steve Thresher26-Oct-01 3:43
Steve Thresher26-Oct-01 3:43 
GeneralListview Custom Draw Pin
Paul C26-Oct-01 1:11
Paul C26-Oct-01 1:11 
GeneralRe: Listview Custom Draw Pin
#realJSOP26-Oct-01 1:24
professional#realJSOP26-Oct-01 1:24 

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.