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. Style Poll

Style Poll

Scheduled Pinned Locked Moved The Lounge
question
68 Posts 40 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.
  • N Offline
    N Offline
    Nitron
    wrote on last edited by
    #1

    How do you guys bracket your code? A:

    if(true){
    DoSomething();
    DoSomethingElse();
    }

    B:

    if(true)
    {
    DoSomething();
    DoSomethingElse();
    }

    C: Other ~Nitron.


    ññòòïðïðB A
    start

    N S A D A 35 Replies Last reply
    0
    • N Nitron

      How do you guys bracket your code? A:

      if(true){
      DoSomething();
      DoSomethingElse();
      }

      B:

      if(true)
      {
      DoSomething();
      DoSomethingElse();
      }

      C: Other ~Nitron.


      ññòòïðïðB A
      start

      N Offline
      N Offline
      Navin
      wrote on last edited by
      #2

      B is clearly the correct case. I suspect the only reason anyone ever even thought about doing A is that publishers wanted code snippets to take up less space in printed books, so a lot of printed example code looked like that. :rolleyes: "I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess

      N R 2 Replies Last reply
      0
      • N Nitron

        How do you guys bracket your code? A:

        if(true){
        DoSomething();
        DoSomethingElse();
        }

        B:

        if(true)
        {
        DoSomething();
        DoSomethingElse();
        }

        C: Other ~Nitron.


        ññòòïðïðB A
        start

        S Offline
        S Offline
        shaunAustin
        wrote on last edited by
        #3

        B.... ----------------------------------------------------------------------- Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!! :-D

        1 Reply Last reply
        0
        • N Navin

          B is clearly the correct case. I suspect the only reason anyone ever even thought about doing A is that publishers wanted code snippets to take up less space in printed books, so a lot of printed example code looked like that. :rolleyes: "I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess

          N Offline
          N Offline
          Nitron
          wrote on last edited by
          #4

          I see a lot of old-school c-coders using A X| ~Nitron.


          ññòòïðïðB A
          start

          M T 2 Replies Last reply
          0
          • N Nitron

            How do you guys bracket your code? A:

            if(true){
            DoSomething();
            DoSomethingElse();
            }

            B:

            if(true)
            {
            DoSomething();
            DoSomethingElse();
            }

            C: Other ~Nitron.


            ññòòïðïðB A
            start

            A Offline
            A Offline
            Alvaro Mendez
            wrote on last edited by
            #5

            B, although I leave a space between the if and the opening parenthesis since it's not a method call. Regards, Alvaro


            "I do" is both the shortest and the longest sentence in the English language.

            1 Reply Last reply
            0
            • N Nitron

              How do you guys bracket your code? A:

              if(true){
              DoSomething();
              DoSomethingElse();
              }

              B:

              if(true)
              {
              DoSomething();
              DoSomethingElse();
              }

              C: Other ~Nitron.


              ññòòïðïðB A
              start

              D Offline
              D Offline
              Daniel Turini
              wrote on last edited by
              #6

              Actually, B, but with proper identation :-D Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski

              I 1 Reply Last reply
              0
              • N Nitron

                How do you guys bracket your code? A:

                if(true){
                DoSomething();
                DoSomethingElse();
                }

                B:

                if(true)
                {
                DoSomething();
                DoSomethingElse();
                }

                C: Other ~Nitron.


                ññòòïðïðB A
                start

                A Offline
                A Offline
                Andy Brummer
                wrote on last edited by
                #7

                B. And if (true)     JustASingleMethod(); Also I tend to have a lot of catch blocks like this try {     //Some code here } catch (ExceptionType) { /*Sink this type for some reason */ } catch (Exception e) { RecordGeneral(e); } -Andy Brummer

                1 Reply Last reply
                0
                • D Daniel Turini

                  Actually, B, but with proper identation :-D Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski

                  I Offline
                  I Offline
                  Ian Darling
                  wrote on last edited by
                  #8

                  Daniel Turini wrote: Actually, B, but with proper identation So is that 2 spaces, 4 spaces, or tabs set to look like 2 or 4 spaces, as opposed to the OPs obviously wrong 3 spaces? :-D


                  Ian Darling "One of the few systems...which has had “no deaths” in the reliability requirements." - Michael Platt

                  N 1 Reply Last reply
                  0
                  • N Nitron

                    How do you guys bracket your code? A:

                    if(true){
                    DoSomething();
                    DoSomethingElse();
                    }

                    B:

                    if(true)
                    {
                    DoSomething();
                    DoSomethingElse();
                    }

                    C: Other ~Nitron.


                    ññòòïðïðB A
                    start

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

                    I have always used B Artificial intelligence is no match for natural stupidity.

                    1 Reply Last reply
                    0
                    • N Nitron

                      How do you guys bracket your code? A:

                      if(true){
                      DoSomething();
                      DoSomethingElse();
                      }

                      B:

                      if(true)
                      {
                      DoSomething();
                      DoSomethingElse();
                      }

                      C: Other ~Nitron.


                      ññòòïðïðB A
                      start

                      S Offline
                      S Offline
                      Steve Mayfield
                      wrote on last edited by
                      #10

                      I use to do this:

                      if(true) {
                      DoSomething();
                      DoSomethingElse();
                      }

                      Now I use "B" with a 2 space indent per level. Steve

                      1 Reply Last reply
                      0
                      • N Nitron

                        How do you guys bracket your code? A:

                        if(true){
                        DoSomething();
                        DoSomethingElse();
                        }

                        B:

                        if(true)
                        {
                        DoSomething();
                        DoSomethingElse();
                        }

                        C: Other ~Nitron.


                        ññòòïðïðB A
                        start

                        J Offline
                        J Offline
                        Jeremy Falcon
                        wrote on last edited by
                        #11

                        B Jeremy Falcon

                        1 Reply Last reply
                        0
                        • N Nitron

                          I see a lot of old-school c-coders using A X| ~Nitron.


                          ññòòïðïðB A
                          start

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

                          Nitron wrote: I see a lot of old-school c-coders using A That's because that was the original C style. As featured in The C Programming Language, Second Edition by Brian W. Kernighan and Dennis M. Ritchie. From which we all learnt our first steps into C. (Well, all us old timers anyway) Of course the better programmers did tend to migrate to the more readable 'B' style ;-) Michael But you know when the truth is told, That you can get what you want or you can just get old, Your're going to kick off before you even get halfway through. When will you realise... Vienna waits for you? - "The Stranger," Billy Joel

                          N 1 Reply Last reply
                          0
                          • N Nitron

                            How do you guys bracket your code? A:

                            if(true){
                            DoSomething();
                            DoSomethingElse();
                            }

                            B:

                            if(true)
                            {
                            DoSomething();
                            DoSomethingElse();
                            }

                            C: Other ~Nitron.


                            ññòòïðïðB A
                            start

                            P Offline
                            P Offline
                            Pavel Klocek
                            wrote on last edited by
                            #13

                            B too. Pavel Sonork 100.15206

                            1 Reply Last reply
                            0
                            • N Nitron

                              How do you guys bracket your code? A:

                              if(true){
                              DoSomething();
                              DoSomethingElse();
                              }

                              B:

                              if(true)
                              {
                              DoSomething();
                              DoSomethingElse();
                              }

                              C: Other ~Nitron.


                              ññòòïðïðB A
                              start

                              R Offline
                              R Offline
                              Radoslav Bielik
                              wrote on last edited by
                              #14

                              Used to do A when I was younger, but I'm using B for about two years now. :) My tab-size is set to 4, and I use the same style for single-statement ifs as Andy Brummer above. rado


                              Radoslav Bielik http://www.neomyz.com/poll [^] - Get your own web poll

                              1 Reply Last reply
                              0
                              • N Nitron

                                How do you guys bracket your code? A:

                                if(true){
                                DoSomething();
                                DoSomethingElse();
                                }

                                B:

                                if(true)
                                {
                                DoSomething();
                                DoSomethingElse();
                                }

                                C: Other ~Nitron.


                                ññòòïðïðB A
                                start

                                J Offline
                                J Offline
                                Jim A Johnson
                                wrote on last edited by
                                #15

                                B, of course; A is unreadable.

                                1 Reply Last reply
                                0
                                • N Nitron

                                  How do you guys bracket your code? A:

                                  if(true){
                                  DoSomething();
                                  DoSomethingElse();
                                  }

                                  B:

                                  if(true)
                                  {
                                  DoSomething();
                                  DoSomethingElse();
                                  }

                                  C: Other ~Nitron.


                                  ññòòïðïðB A
                                  start

                                  _ Offline
                                  _ Offline
                                  _Magnus_
                                  wrote on last edited by
                                  #16

                                  B, i hate reading A style, looks like B style code after an earthquake. /Magnus


                                  - I don't necessarily agree with everything I say

                                  1 Reply Last reply
                                  0
                                  • N Navin

                                    B is clearly the correct case. I suspect the only reason anyone ever even thought about doing A is that publishers wanted code snippets to take up less space in printed books, so a lot of printed example code looked like that. :rolleyes: "I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess

                                    R Offline
                                    R Offline
                                    RChin
                                    wrote on last edited by
                                    #17

                                    Navin wrote: B is clearly the correct case. Here, Here. Anything else is abserd and illogical!!


                                    I Dream of Absolute Zero

                                    1 Reply Last reply
                                    0
                                    • N Nitron

                                      How do you guys bracket your code? A:

                                      if(true){
                                      DoSomething();
                                      DoSomethingElse();
                                      }

                                      B:

                                      if(true)
                                      {
                                      DoSomething();
                                      DoSomethingElse();
                                      }

                                      C: Other ~Nitron.


                                      ññòòïðïðB A
                                      start

                                      M Offline
                                      M Offline
                                      Matt Newman
                                      wrote on last edited by
                                      #18

                                      B, my professor uses A though :rolleyes: Matt Newman

                                      1 Reply Last reply
                                      0
                                      • N Nitron

                                        How do you guys bracket your code? A:

                                        if(true){
                                        DoSomething();
                                        DoSomethingElse();
                                        }

                                        B:

                                        if(true)
                                        {
                                        DoSomething();
                                        DoSomethingElse();
                                        }

                                        C: Other ~Nitron.


                                        ññòòïðïðB A
                                        start

                                        J Offline
                                        J Offline
                                        Joel Holdsworth
                                        wrote on last edited by
                                        #19

                                        B of course - but i don't understand how anyone could mistaxe if(_whatever_) for a function call especially as the if turns a blue colour! Joel Holdsworth

                                        A R B 3 Replies Last reply
                                        0
                                        • N Nitron

                                          How do you guys bracket your code? A:

                                          if(true){
                                          DoSomething();
                                          DoSomethingElse();
                                          }

                                          B:

                                          if(true)
                                          {
                                          DoSomething();
                                          DoSomethingElse();
                                          }

                                          C: Other ~Nitron.


                                          ññòòïðïðB A
                                          start

                                          M Offline
                                          M Offline
                                          Mazdak
                                          wrote on last edited by
                                          #20

                                          B Mazy You're face to face, With the man who sold the world - David Bowie

                                          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