Figure out this code...
-
Following in Chris L's footsteps, here's my Wacky Code Snippet of the Day:
struct CFoo
{
string sURL;CFoo ( const string& sURL ) : sURL(sURL) { }
};So tell me, which
sURL
variable does the "sURL" in blue refer to? And the one in red? This actually compiles in VC 6, and I didn't notice it until just now because I have a constructor that takes anLPCTSTR
as well and I just happened to never call the one shown above. --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm -
Following in Chris L's footsteps, here's my Wacky Code Snippet of the Day:
struct CFoo
{
string sURL;CFoo ( const string& sURL ) : sURL(sURL) { }
};So tell me, which
sURL
variable does the "sURL" in blue refer to? And the one in red? This actually compiles in VC 6, and I didn't notice it until just now because I have a constructor that takes anLPCTSTR
as well and I just happened to never call the one shown above. --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm -
Following in Chris L's footsteps, here's my Wacky Code Snippet of the Day:
struct CFoo
{
string sURL;CFoo ( const string& sURL ) : sURL(sURL) { }
};So tell me, which
sURL
variable does the "sURL" in blue refer to? And the one in red? This actually compiles in VC 6, and I didn't notice it until just now because I have a constructor that takes anLPCTSTR
as well and I just happened to never call the one shown above. --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_HelmI'm lost. :-( Regardz Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining. Said by Roger Wright about me.
-
I'm lost. :-( Regardz Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining. Said by Roger Wright about me.
I wrote that code, imagine what state of mind I was in at the time. ;) --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm
-
Following in Chris L's footsteps, here's my Wacky Code Snippet of the Day:
struct CFoo
{
string sURL;CFoo ( const string& sURL ) : sURL(sURL) { }
};So tell me, which
sURL
variable does the "sURL" in blue refer to? And the one in red? This actually compiles in VC 6, and I didn't notice it until just now because I have a constructor that takes anLPCTSTR
as well and I just happened to never call the one shown above. --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm -
Good example as to why it's worth to add "m_" prefix to the member variables...
I C++, therefore I am...
-
Following in Chris L's footsteps, here's my Wacky Code Snippet of the Day:
struct CFoo
{
string sURL;CFoo ( const string& sURL ) : sURL(sURL) { }
};So tell me, which
sURL
variable does the "sURL" in blue refer to? And the one in red? This actually compiles in VC 6, and I didn't notice it until just now because I have a constructor that takes anLPCTSTR
as well and I just happened to never call the one shown above. --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_HelmThe blue sURL should IMHO only belong to the CFoo:: scope. But I'm sure VC6 chains the parameter scope as well, thus initializing the parameter again with itself. :) Semantically, there is no point in initializing an argument - it's already been initialized! How the hell could it else be passed to the constructor? I'm no C++ commitee member, but I'm 100% positive that this is yet another C++-bug in VC6. If you were another man, I would kill you where you stand! The line must be drawn here! This far, no further! They must pay for what they've done!