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 Weird and The Wonderful
  4. For your consideration

For your consideration

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
6 Posts 4 Posters 31 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.
  • G Offline
    G Offline
    Gary R Wheeler
    wrote on last edited by
    #1
       switch (es) {
              case CS\_DISENABLED: return ::CreateSolidBrush(brRed);        break;
              case CS\_ENABLED:    return ::GetSysColorBrush(COLOR\_WINDOW); break;     
              case CS\_UNDEF:      return ::CreateSolidBrush(brRed);        break;     
              default:            return ::CreateSolidBrush(brRed);        break;     
       }
    

    What's wrong here? I'll wait.

    Software Zen: delete this;

    raddevusR 1 Reply Last reply
    0
    • G Gary R Wheeler
         switch (es) {
                case CS\_DISENABLED: return ::CreateSolidBrush(brRed);        break;
                case CS\_ENABLED:    return ::GetSysColorBrush(COLOR\_WINDOW); break;     
                case CS\_UNDEF:      return ::CreateSolidBrush(brRed);        break;     
                default:            return ::CreateSolidBrush(brRed);        break;     
         }
      

      What's wrong here? I'll wait.

      Software Zen: delete this;

      raddevusR Online
      raddevusR Online
      raddevus
      wrote on last edited by
      #2
      1. none of the break statements are ever hit 2) default does not require nor need break statement 3) DISENABLED is a very odd word. those are all I got right now. :-D
      Mircea NeacsuM G 2 Replies Last reply
      0
      • raddevusR raddevus
        1. none of the break statements are ever hit 2) default does not require nor need break statement 3) DISENABLED is a very odd word. those are all I got right now. :-D
        Mircea NeacsuM Offline
        Mircea NeacsuM Offline
        Mircea Neacsu
        wrote on last edited by
        #3

        Not to mention that it could be written as:

        return (es == CS_ENABLED)?::GetSysColorBrush(COLOR_WINDOW) : ::CreateSolidBrush(brRed);

        I woke up today with a bad case of one-line syndrome :)

        Mircea

        G 1 Reply Last reply
        0
        • raddevusR raddevus
          1. none of the break statements are ever hit 2) default does not require nor need break statement 3) DISENABLED is a very odd word. those are all I got right now. :-D
          G Offline
          G Offline
          Gary R Wheeler
          wrote on last edited by
          #4

          Your #3 was the first thing I noticed, followed by #1. I think #2 is a matter of personal taste, as that works only when the default: case is the last one in the switch statement. FWIW, "disenabled" grates on my nerves only slightly less than the British word "orientate". I'm a third-generation 'Murican descended from German immigrants, and I use "orient" as the verb.

          Software Zen: delete this;

          R 1 Reply Last reply
          0
          • Mircea NeacsuM Mircea Neacsu

            Not to mention that it could be written as:

            return (es == CS_ENABLED)?::GetSysColorBrush(COLOR_WINDOW) : ::CreateSolidBrush(brRed);

            I woke up today with a bad case of one-line syndrome :)

            Mircea

            G Offline
            G Offline
            Gary R Wheeler
            wrote on last edited by
            #5

            Mircea Neacsu wrote:

            a bad case of one-line syndrome

            This is one case where I actually like one-line solutions, especially using the conditional operator. I have a prejudice against using it in any case that takes more than a single line, or at worst something like this:

            value = condition ?
            true-value :
            false-value;

            Anything more involved than that, and I want it expressed as a complete if statement.

            Software Zen: delete this;

            1 Reply Last reply
            0
            • G Gary R Wheeler

              Your #3 was the first thing I noticed, followed by #1. I think #2 is a matter of personal taste, as that works only when the default: case is the last one in the switch statement. FWIW, "disenabled" grates on my nerves only slightly less than the British word "orientate". I'm a third-generation 'Murican descended from German immigrants, and I use "orient" as the verb.

              Software Zen: delete this;

              R Offline
              R Offline
              Rob Grainger
              wrote on last edited by
              #6

              To the rest of the world (who actually speak English ;) ), the Orient is a (somewhat dated) way to refer to the Far East. It's where oriental is derived.

              "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

              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