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. The Lounge
  3. if else standards...

if else standards...

Scheduled Pinned Locked Moved The Lounge
wpf
19 Posts 13 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 Jorgen Sigvardsson

    Chris Maunder wrote: Whitespace is free. Screen estate isn't. :) Besides, now that VS.NET have caught up with early 90's [X]Emacs technology (matching brackets and smart indentation), mismatched crackets isn't that much of an issue as it was say 2 years ago. :) I am however missing the XEmacs feature "highlight expression". It highlights the expression under the cursor. So if the cursor is on the firs {, the editor would then change the background color on all text between the first { and the matching }. Now that's a killer feature, because it'll help you find mismatched stuff real easy. Why hasn't it been implemented I wonder? I doubt it's possible to hack it as a IDE script either, because I don't think it's possible to manipulate the color attributes of a specific text span. <desperate>Wasn't our friend Nick Hodapp a VS.NET manager kind of guy? Can you hear me Nick? Nick?! Nick!?!? I'm on me knees, begging you man! Please give me "highlight expression". Pretty please with sugar on top!</desperate> -- Oneigaishimasu! I blog too now[^]

    Z Offline
    Z Offline
    Zdeslav Vojkovic
    wrote on last edited by
    #10

    Jörgen Sigvardsson wrote: So if the cursor is on the firs {, the editor would then change the background color on all text between the first { and the matching } you can achieve something similar with ctrl+shift+]. it doesn't change the color, but selects the expresion. it works on VS6, and most likely on VS.NET, too. i know it's not the same as "highlight expression", but still it can help.

    J 1 Reply Last reply
    0
    • C Chris Maunder

      Jörgen Sigvardsson wrote: Chris Maunder wrote: Whitespace is free. Screen estate isn't. There is no way I'm letting you get away that argument. If you're still using a 1024 x 768 monitor then we'll start a New Monitor for Jörgen Fund :) Jörgen Sigvardsson wrote: Wasn't our friend Nick Hodapp a VS.NET manager kind of guy? He was (past tense) Product Manager (ie Marketing person) for Visual C++. He could only wail and gnash his teeth at the Program Manager to get new features implements. He's since headed to greener pastures. cheers, Chris Maunder

      A Offline
      A Offline
      Anna Jayne Metcalfe
      wrote on last edited by
      #11

      Chris Maunder wrote: Jörgen Sigvardsson wrote: Wasn't our friend Nick Hodapp a VS.NET manager kind of guy? He was (past tense) Product Manager (ie Marketing person) for Visual C++. He could only wail and gnash his teeth at the Program Manager to get new features implements. He's since headed to greener pastures. That would explain why his column has ground to a dead halt then. Any idea where he's moved on to? Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

      1 Reply Last reply
      0
      • C Chris Maunder

        The first one. Brackets on the same line are just asking for trouble (ie missed/mismatched brackets) if you ask me. Whitespace is free. cheers, Chris Maunder

        A Offline
        A Offline
        Anna Jayne Metcalfe
        wrote on last edited by
        #12

        Definitely. Even with the aid of tools such as Visual Assist X the other styles are not something I care to come across. Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

        1 Reply Last reply
        0
        • C Chris Maunder

          Jörgen Sigvardsson wrote: Chris Maunder wrote: Whitespace is free. Screen estate isn't. There is no way I'm letting you get away that argument. If you're still using a 1024 x 768 monitor then we'll start a New Monitor for Jörgen Fund :) Jörgen Sigvardsson wrote: Wasn't our friend Nick Hodapp a VS.NET manager kind of guy? He was (past tense) Product Manager (ie Marketing person) for Visual C++. He could only wail and gnash his teeth at the Program Manager to get new features implements. He's since headed to greener pastures. cheers, Chris Maunder

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

          Chris Maunder wrote: . If you're still using a 1024 x 768 monitor then we'll start a New Monitor for Jörgen Fund I'd be happier if you'd start a "New Eyes for Jörgen Fund". Eventhough I'm using prescribed glasses, my eyesight isn't what it used to be. :) [edit]Meaning: I want to see as much code as possible on one page[edit] Chris Maunder wrote: He's since headed to greener pastures. Good for him :) -- Oneigaishimasu! I blog too now[^]

          B 1 Reply Last reply
          0
          • Z Zdeslav Vojkovic

            Jörgen Sigvardsson wrote: So if the cursor is on the firs {, the editor would then change the background color on all text between the first { and the matching } you can achieve something similar with ctrl+shift+]. it doesn't change the color, but selects the expresion. it works on VS6, and most likely on VS.NET, too. i know it's not the same as "highlight expression", but still it can help.

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

            It's too manual and it's a bit too risky with a selection... And yeah, I forgot to mention that "highlight expression" works on (), [] and {}; I *think* it works on case/break too, but I'm unsure as it was quite some time ago I used XEmacs. -- Oneigaishimasu! I blog too now[^]

            Z 1 Reply Last reply
            0
            • J Jorgen Sigvardsson

              It's too manual and it's a bit too risky with a selection... And yeah, I forgot to mention that "highlight expression" works on (), [] and {}; I *think* it works on case/break too, but I'm unsure as it was quite some time ago I used XEmacs. -- Oneigaishimasu! I blog too now[^]

              Z Offline
              Z Offline
              Zdeslav Vojkovic
              wrote on last edited by
              #15

              this works on (), [] and {} in VS, at least on my machine :) but i agree that it's too manual. maybe we should post a feature request for Visual Assist or Resharper?

              1 Reply Last reply
              0
              • J Jorgen Sigvardsson

                Chris Maunder wrote: . If you're still using a 1024 x 768 monitor then we'll start a New Monitor for Jörgen Fund I'd be happier if you'd start a "New Eyes for Jörgen Fund". Eventhough I'm using prescribed glasses, my eyesight isn't what it used to be. :) [edit]Meaning: I want to see as much code as possible on one page[edit] Chris Maunder wrote: He's since headed to greener pastures. Good for him :) -- Oneigaishimasu! I blog too now[^]

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

                Well if you're going to get new eyes then I want some too... I'd settle for the LASIK or LASEK surgery though ;-) Regards, Brian Dela :-) Now Bloging![^]

                1 Reply Last reply
                0
                • C Chris Maunder

                  The first one. Brackets on the same line are just asking for trouble (ie missed/mismatched brackets) if you ask me. Whitespace is free. cheers, Chris Maunder

                  B Offline
                  B Offline
                  Blake Miller
                  wrote on last edited by
                  #17

                  It is funny you mention that, because some of the most OBSCURE programming errors we have encountered here are because someone puts the opening brace on the next line, and a maintenance guy comes along and puts a statement BETWEEN the if line and the opening brace! this: if( x ) { } else { } gets converted into if( x ) y; { }else { } Now that REALLY jacks up your code!

                  D 1 Reply Last reply
                  0
                  • B Blake Miller

                    It is funny you mention that, because some of the most OBSCURE programming errors we have encountered here are because someone puts the opening brace on the next line, and a maintenance guy comes along and puts a statement BETWEEN the if line and the opening brace! this: if( x ) { } else { } gets converted into if( x ) y; { }else { } Now that REALLY jacks up your code!

                    D Offline
                    D Offline
                    David Patrick
                    wrote on last edited by
                    #18

                    This is the first legitimate reason I've seen for not using the first form ... ... but, I'm still sticking to first format anyhow.

                    B 1 Reply Last reply
                    0
                    • D David Patrick

                      This is the first legitimate reason I've seen for not using the first form ... ... but, I'm still sticking to first format anyhow.

                      B Offline
                      B Offline
                      Blake Miller
                      wrote on last edited by
                      #19

                      In about 20 years of coding C that is the ONLY reason I have been able to accept for not using the first form. Recently, I find it easier to accept because the IDE will match braces for me anyway. Along similar lines, do people prefer this: if( x ) { } or this if ( x ) { } of the one I like: if( x ){ } For some reason my 'processor' is happier if the parenthesis is more closely grouped with the control statement or its close expression than not. I like this: if( x && (y == 1) ){ more than if ( x && ( y == 1 ) ) { for example.

                      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