Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Back Room
  4. Figure out this code...

Figure out this code...

Scheduled Pinned Locked Moved The Back Room
comsecurityquestion
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michael Dunn
    wrote on last edited by
    #1

    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 an LPCTSTR 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

    S C G J 4 Replies Last reply
    0
    • M Michael Dunn

      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 an LPCTSTR 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

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      sURL would only make sense referring to the class member... but i wouldn't care to try it just the same! :~

      [Shog9]

      1 Reply Last reply
      0
      • M Michael Dunn

        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 an LPCTSTR 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

        C Offline
        C Offline
        ColinDavies
        wrote on last edited by
        #3

        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.

        M 1 Reply Last reply
        0
        • C ColinDavies

          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.

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • M Michael Dunn

            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 an LPCTSTR 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

            G Offline
            G Offline
            George
            wrote on last edited by
            #5

            Good example as to why it's worth to add "m_" prefix to the member variables...

            I C++, therefore I am...

            L 1 Reply Last reply
            0
            • G George

              Good example as to why it's worth to add "m_" prefix to the member variables...

              I C++, therefore I am...

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Damn straight baby.


              Faith. Believing in something you *know* isn't true.

              1 Reply Last reply
              0
              • M Michael Dunn

                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 an LPCTSTR 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

                J Offline
                J Offline
                Jorgen Sigvardsson
                wrote on last edited by
                #7

                The 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!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups