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 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
    Luca Leonardo Scorcia
    wrote on last edited by
    #48

    Well... since nobody does, I dare to say I use and prefer A. I find it MUCH more readable, uses less screen space (we all know what a screen-eater is VS), and I save an Enter at each indent. When I need to underline the bracket of course B is the way to go, but often simple indentation is enough. Oh, and one last thing: for function definitions A is my preferred way. Example:

    void DailyPrayer(int times)
    {
    for (int i = 0; i < times; ++i) {
    printf("I love CP\r\n");
    printf("And you?\r\n");
    }

    for (int i = 0; i < times; ++i)
        printf("http://www.codeproject.com");
    

    }

    Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

    J 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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #49

      I use B, always have, always will ( well, not really, I believe having a standard is more important than it's details, I would follow any standard my employer set ). But I'm curious about a few things 1. With two simple choices, why was this not a 'vote 5 for, vote 1 for' poll, and 2. Why is it that every post on this thread that I look at has been voted for twice and has a score of 3 ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

      N N 2 Replies Last reply
      0
      • C Christian Graus

        I use B, always have, always will ( well, not really, I believe having a standard is more important than it's details, I would follow any standard my employer set ). But I'm curious about a few things 1. With two simple choices, why was this not a 'vote 5 for, vote 1 for' poll, and 2. Why is it that every post on this thread that I look at has been voted for twice and has a score of 3 ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

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

        Christian Graus wrote: 2. Why is it that every post on this thread that I look at has been voted for twice and has a score of 3 ? See a post I made a little while ago, some spineless coward voted all the posts in favor of "B" a 1. So I went and voted them a 5, just so they weren't all at 1. "I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess

        C 1 Reply Last reply
        0
        • N Navin

          Christian Graus wrote: 2. Why is it that every post on this thread that I look at has been voted for twice and has a score of 3 ? See a post I made a little while ago, some spineless coward voted all the posts in favor of "B" a 1. So I went and voted them a 5, just so they weren't all at 1. "I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #51

          Ah... I guess it's almost as if I was right when I said that post voting sucks :-) Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

          A 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
            #52

            B ! The tigress is here :-D

            1 Reply Last reply
            0
            • N Navin

              Once you've started doing "B", you'll never look back, and wonder why you ever coded with "A" at all. :cool: "I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess

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

              *Elaine nods in agreement* The tigress is here :-D

              1 Reply Last reply
              0
              • N Navin

                Once you've started doing "B", you'll never look back, and wonder why you ever coded with "A" at all. :cool: "I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess

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

                I started out with B, and ended up with A. :cool: A is truly for those who have not only seen the light, but felt it and embraced it. It's like being touched by the hand of God. Or so they say. ;) -- Meine Welt ist monoton und minimal, doch ganz total!

                N 1 Reply Last reply
                0
                • L Luca Leonardo Scorcia

                  Well... since nobody does, I dare to say I use and prefer A. I find it MUCH more readable, uses less screen space (we all know what a screen-eater is VS), and I save an Enter at each indent. When I need to underline the bracket of course B is the way to go, but often simple indentation is enough. Oh, and one last thing: for function definitions A is my preferred way. Example:

                  void DailyPrayer(int times)
                  {
                  for (int i = 0; i < times; ++i) {
                  printf("I love CP\r\n");
                  printf("And you?\r\n");
                  }

                  for (int i = 0; i < times; ++i)
                      printf("http://www.codeproject.com");
                  

                  }

                  Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

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

                  I would enjoy programming with you, Sir! :cool: -- Meine Welt ist monoton und minimal, doch ganz total!

                  1 Reply Last reply
                  0
                  • C Christian Graus

                    Ah... I guess it's almost as if I was right when I said that post voting sucks :-) Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

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

                    Christian Graus wrote: Ah... I guess it's almost as if I was right when I said that post voting sucks I've said many-a-times that voting would have a tendency to suck a lot less if we could tell who the voters were and what their vote was. This anonymous voting crap is almost as bad as allowing anonymous posts in the lounge. 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

                      S Offline
                      S Offline
                      Steven Hicks n 1
                      wrote on last edited by
                      #57

                      B! I really can't stand code that is formated as A, it gets to be a PITA when trying to trace down where it begins and ends. -Steven Hicks

                      CPA

                      CodeProjectAddict

                      Actual Linux Penguins were harmed in the creation of this message.

                      More tutorials: Ltpb.8m.com: Tutorials |404Browser.com (Download Link)

                      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
                        Ravi Bhavnani
                        wrote on last edited by
                        #58

                        I used to use (B) for years (cut my teeth on Windows), but after working in a Java shop for a couple of years, I switched to (A). Now, (A) just feels right and sorta more "hardcore" than (B), which feels weenie like. Go figure. :) /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                        J 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
                          Michael Dunn
                          wrote on last edited by
                          #59

                          There are two rules of style: 1. I put the braces in different places than you. 2. Your style is lame. ;) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.

                          J J 2 Replies Last reply
                          0
                          • M Michael Dunn

                            There are two rules of style: 1. I put the braces in different places than you. 2. Your style is lame. ;) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.

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

                            I agree. ;) Michael Dunn wrote: 1. I put the braces in different places than you. Taken out of context, I bloody well hope so! :-D -- Meine Welt ist monoton und minimal, doch ganz total!

                            1 Reply Last reply
                            0
                            • R Ravi Bhavnani

                              I used to use (B) for years (cut my teeth on Windows), but after working in a Java shop for a couple of years, I switched to (A). Now, (A) just feels right and sorta more "hardcore" than (B), which feels weenie like. Go figure. :) /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

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

                              It's K&R (partially) hardcore. :cool: -- Meine Welt ist monoton und minimal, doch ganz total!

                              R 1 Reply Last reply
                              0
                              • Y Yusuf

                                B: I wonder why no body mentioned one clear advantage of A in the old times? what is wrong with this code? if(true){; DoSomething(); DoSomethingElse(); }

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

                                Yusuf wrote: what is wrong with this code? Nothing..? Unless you believe an extra empty statement is wrong. Had you written:

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

                                there would have been something (most likely) wrong. -- Meine Welt ist monoton und minimal, doch ganz total!

                                1 Reply Last reply
                                0
                                • J Jorgen Sigvardsson

                                  I started out with B, and ended up with A. :cool: A is truly for those who have not only seen the light, but felt it and embraced it. It's like being touched by the hand of God. Or so they say. ;) -- Meine Welt ist monoton und minimal, doch ganz total!

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

                                  Ah, I fear you have been lead astray by a false prophet. :~ But it's still not too late to change. There is hope yet. "I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess

                                  1 Reply Last reply
                                  0
                                  • C Christian Graus

                                    I use B, always have, always will ( well, not really, I believe having a standard is more important than it's details, I would follow any standard my employer set ). But I'm curious about a few things 1. With two simple choices, why was this not a 'vote 5 for, vote 1 for' poll, and 2. Why is it that every post on this thread that I look at has been voted for twice and has a score of 3 ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

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

                                    Christian Graus wrote: 1. With two simple choices, why was this not a 'vote 5 for, vote 1 for' poll, and i guess im just not that creative :rolleyes: ~Nitron.


                                    ññòòïðïðB A
                                    start

                                    1 Reply Last reply
                                    0
                                    • M Michael Dunn

                                      There are two rules of style: 1. I put the braces in different places than you. 2. Your style is lame. ;) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.

                                      J Offline
                                      J Offline
                                      Jim Crafton
                                      wrote on last edited by
                                      #65

                                      Given Mikes clear infatuation with Erica, I say we all contribute some money into a pot, ask Chris to call someone at MS HR (or wherever) and set Mike up with a date with Erica! I'm in for $20! ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned

                                      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
                                        John M Drescher
                                        wrote on last edited by
                                        #66

                                        Definitly A because I want to conserve lines and B is no more readable to me than A. John

                                        1 Reply Last reply
                                        0
                                        • J Jorgen Sigvardsson

                                          It's K&R (partially) hardcore. :cool: -- Meine Welt ist monoton und minimal, doch ganz total!

                                          R Offline
                                          R Offline
                                          Ravi Bhavnani
                                          wrote on last edited by
                                          #67

                                          K&R rocks. I still have my 1980 edition. :) /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                                          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