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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Other Discussions
  3. The Back Room
  4. Oh, give me a break!

Oh, give me a break!

Scheduled Pinned Locked Moved The Back Room
csharpjavagraphicshelp
9 Posts 5 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.
  • J Offline
    J Offline
    Jorgen Sigvardsson
    wrote on last edited by
    #1

    C# is treating me like a java kiddie. :(( error CS0136: A local variable named 'g' cannot be declared in this scope because it would give a different meaning to 'g', which is already used in a 'child' scope to denote something else The code looks like sort of like this:

    if(DesignMode) {
    Graphics g = e.Graphics;
    ...
    return;
    }
    ...
    Graphics g = e.Graphics;
    ...

    :wtf: Give me a break! No g will ever shadow the other g. Not even if hell freezes over. I'm beginning to suspect that C# is slightly retarded. I could have sorta agreed with it if I had declared the outer g before the child scope. I AM NOT A BLOODY JAVA WEENIE, SO STOP TREATING ME LIKE ONE, YOU HALF WITTED NO-GOOD COMPILER! -- "And God said, Let us make man in our image"

    B P M 3 Replies Last reply
    0
    • J Jorgen Sigvardsson

      C# is treating me like a java kiddie. :(( error CS0136: A local variable named 'g' cannot be declared in this scope because it would give a different meaning to 'g', which is already used in a 'child' scope to denote something else The code looks like sort of like this:

      if(DesignMode) {
      Graphics g = e.Graphics;
      ...
      return;
      }
      ...
      Graphics g = e.Graphics;
      ...

      :wtf: Give me a break! No g will ever shadow the other g. Not even if hell freezes over. I'm beginning to suspect that C# is slightly retarded. I could have sorta agreed with it if I had declared the outer g before the child scope. I AM NOT A BLOODY JAVA WEENIE, SO STOP TREATING ME LIKE ONE, YOU HALF WITTED NO-GOOD COMPILER! -- "And God said, Let us make man in our image"

      B Offline
      B Offline
      Brian Delahunty
      wrote on last edited by
      #2

      You serious???.. Didn't think C# would be that finicky. Regards, Brian Dela :-)
      Run naked in the snow until you're sweating like a stuck pig and can't seem to catch your breath. When the flu becomes pneumonia, they can cure that with a shot. - Roger Wright

      1 Reply Last reply
      0
      • J Jorgen Sigvardsson

        C# is treating me like a java kiddie. :(( error CS0136: A local variable named 'g' cannot be declared in this scope because it would give a different meaning to 'g', which is already used in a 'child' scope to denote something else The code looks like sort of like this:

        if(DesignMode) {
        Graphics g = e.Graphics;
        ...
        return;
        }
        ...
        Graphics g = e.Graphics;
        ...

        :wtf: Give me a break! No g will ever shadow the other g. Not even if hell freezes over. I'm beginning to suspect that C# is slightly retarded. I could have sorta agreed with it if I had declared the outer g before the child scope. I AM NOT A BLOODY JAVA WEENIE, SO STOP TREATING ME LIKE ONE, YOU HALF WITTED NO-GOOD COMPILER! -- "And God said, Let us make man in our image"

        P Offline
        P Offline
        peterchen
        wrote on last edited by
        #3

        Jörgen Sigvardsson wrote: I AM NOT A BLOODY JAVA WEENIE, SO STOP TREATING ME LIKE ONE, YOU HALF WITTED NO-GOOD COMPILER! obviously, you forgot to specify the /nojavaoperator cmd line option when installing .NET :rolleyes: Seems like C# does resolve conflicts based solely on scope - the same as C++ does...


        If you look for evil in me, you will find it. Whether it's there or not. [sighist] | [Agile Programming] [doxygen]

        M J 2 Replies Last reply
        0
        • P peterchen

          Jörgen Sigvardsson wrote: I AM NOT A BLOODY JAVA WEENIE, SO STOP TREATING ME LIKE ONE, YOU HALF WITTED NO-GOOD COMPILER! obviously, you forgot to specify the /nojavaoperator cmd line option when installing .NET :rolleyes: Seems like C# does resolve conflicts based solely on scope - the same as C++ does...


          If you look for evil in me, you will find it. Whether it's there or not. [sighist] | [Agile Programming] [doxygen]

          M Offline
          M Offline
          Megan Forbes
          wrote on last edited by
          #4

          peterchen wrote: /nojavaoperator cmd line option when installing .NET :laugh: Lol, nice!


          Throw in a bit of S&M or eye-ball sucking**-Paul Watson on the merits of swearing, sex and obscenities in CP posts** ...they assumed that reasonably intelligent adults would know enough to leave the building if it was burning. Those who did not were, presumably, expendable, and there was less paperwork involved than trying to fire them**-Roger Wright on fire drills at work**

          1 Reply Last reply
          0
          • J Jorgen Sigvardsson

            C# is treating me like a java kiddie. :(( error CS0136: A local variable named 'g' cannot be declared in this scope because it would give a different meaning to 'g', which is already used in a 'child' scope to denote something else The code looks like sort of like this:

            if(DesignMode) {
            Graphics g = e.Graphics;
            ...
            return;
            }
            ...
            Graphics g = e.Graphics;
            ...

            :wtf: Give me a break! No g will ever shadow the other g. Not even if hell freezes over. I'm beginning to suspect that C# is slightly retarded. I could have sorta agreed with it if I had declared the outer g before the child scope. I AM NOT A BLOODY JAVA WEENIE, SO STOP TREATING ME LIKE ONE, YOU HALF WITTED NO-GOOD COMPILER! -- "And God said, Let us make man in our image"

            M Offline
            M Offline
            Michael P Butler
            wrote on last edited by
            #5

            Surely the correct coding style would have been?

            Graphics g = e.Graphics;

            if(DesignMode)
            {
            ...
            return;
            }

            ...

            ...

            or is that just me? Michael Wonder Woman, Wonder Woman. All the world's waiting for you, and the power you possess. In your satin tights, Fighting for your rights And the old Red, White and Blue.

            J 1 Reply Last reply
            0
            • P peterchen

              Jörgen Sigvardsson wrote: I AM NOT A BLOODY JAVA WEENIE, SO STOP TREATING ME LIKE ONE, YOU HALF WITTED NO-GOOD COMPILER! obviously, you forgot to specify the /nojavaoperator cmd line option when installing .NET :rolleyes: Seems like C# does resolve conflicts based solely on scope - the same as C++ does...


              If you look for evil in me, you will find it. Whether it's there or not. [sighist] | [Agile Programming] [doxygen]

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

              peterchen wrote: obviously, you forgot to specify the /nojavaoperator cmd line option when installing .NET Hmm. I tried the /pleasedontcraponmycode option. Obviously, it didn't work out as I had expected. :-D peterchen wrote: Seems like C# does resolve conflicts based solely on scope - the same as C++ does... :confused: C++ wouldn't have had any problems with the code example I showed. In fact, you can shadow names as much as you want in C++! Except for declaration of variables in for( ; ; ). Some compilers declare the variable outside the for scope, while others declare it inside the scope. Some compilers give you the option to chose, while there is rule in C++ which allows only one of them. I'm not sure, but I think the rule says that such variables belong inside the for block and is thus not visible after the block. -- "And God said, Let us make man in our image"

              1 Reply Last reply
              0
              • M Michael P Butler

                Surely the correct coding style would have been?

                Graphics g = e.Graphics;

                if(DesignMode)
                {
                ...
                return;
                }

                ...

                ...

                or is that just me? Michael Wonder Woman, Wonder Woman. All the world's waiting for you, and the power you possess. In your satin tights, Fighting for your rights And the old Red, White and Blue.

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

                Michael P Butler wrote: Surely the correct coding style would have been? Yes it is. :-O I changed it to that after the compiler took a crap on my code. But that's the kind of stuff I refactor later. When I've got the basic design onto paper/file/whatever, I usually just sit down and code the damn thing. I don't care much about reuse/intelligent use of variables when I do the first sweep. I try to focus on the problem at hand, and then beautify the code in a second sweep. The thing is though, these scoping rules are baffling. In pretty much all structured programming languages I've used, scopes are managed in a tree fashion. The further down you get in the tree, the large the namespace is. But in C# its a big friggin sequence?! It reminds me a little of PERL... (when not using my and/or local that is) -- "And God said, Let us make man in our image"

                M 1 Reply Last reply
                0
                • J Jorgen Sigvardsson

                  Michael P Butler wrote: Surely the correct coding style would have been? Yes it is. :-O I changed it to that after the compiler took a crap on my code. But that's the kind of stuff I refactor later. When I've got the basic design onto paper/file/whatever, I usually just sit down and code the damn thing. I don't care much about reuse/intelligent use of variables when I do the first sweep. I try to focus on the problem at hand, and then beautify the code in a second sweep. The thing is though, these scoping rules are baffling. In pretty much all structured programming languages I've used, scopes are managed in a tree fashion. The further down you get in the tree, the large the namespace is. But in C# its a big friggin sequence?! It reminds me a little of PERL... (when not using my and/or local that is) -- "And God said, Let us make man in our image"

                  M Offline
                  M Offline
                  Michael P Butler
                  wrote on last edited by
                  #8

                  Jörgen Sigvardsson wrote: But that's the kind of stuff I refactor later Sadly, I've got into the habit of designing my code first. Something I never expected I would do. I found if I design it first then I've got less typing to do. (I hate typing code) ;-) Michael Wonder Woman, Wonder Woman. All the world's waiting for you, and the power you possess. In your satin tights, Fighting for your rights And the old Red, White and Blue.

                  J 1 Reply Last reply
                  0
                  • M Michael P Butler

                    Jörgen Sigvardsson wrote: But that's the kind of stuff I refactor later Sadly, I've got into the habit of designing my code first. Something I never expected I would do. I found if I design it first then I've got less typing to do. (I hate typing code) ;-) Michael Wonder Woman, Wonder Woman. All the world's waiting for you, and the power you possess. In your satin tights, Fighting for your rights And the old Red, White and Blue.

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

                    I used to be just like that before too. But I've come to the conclusion that code in development is not static. Sooner or later I get this idea of doing it better for whatever reason. Then I have to rewrite all that code I tried to make so pretty to begin with! I do however try to make the concepts as generic as possible though. That way I can perhaps just tweak it or replace parts of the implementation without breaking the overall design and interfaces. I do all the beautifications just before I tag the code in CVS and after I'm happy with the design/implementation details. I figure that's the least wear and tear on fingers and mind. :) -- "And God said, Let us make man in our image"

                    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