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. Code style

Code style

Scheduled Pinned Locked Moved The Lounge
questioncss
39 Posts 27 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 Nemanja Trifunovic

    private:
    void foo()
    {
    //statements
    }

    Company standard. Felt strange at first, but I got used to it, and now I use it everywhere


    My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

    C Offline
    C Offline
    Chris Losinger
    wrote on last edited by
    #25

    that's our standard, too. but i refuse to use it, as i think it's fundamentally wrong. Software | Cleek

    1 Reply Last reply
    0
    • J Jorgen Sigvardsson

      Are you trying to start a flame war in the lounge? ;) [edit]I agree with you :)[/edit] -- Denn du bist, was du isst! Und ihr wisst, was es ist! Es ist mein Teil...?

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

      *must* *resist* *to* *flame* *Jörgen*


      we are here to help each other get through this thing, whatever it is Vonnegut jr.
      sighist || Agile Programming | doxygen

      J 1 Reply Last reply
      0
      • L lotuspro

        i've been chatting with the new guy at work today and he respectfully informs me he can't recall the last time he saw this notation: private void foo() { //statements } and contends that almost always people use: private void foo() { //statements } which to me is a total waste of a linebreak and less readable. worse still, the other new dude concurs? whassup with that? being a fan of the former notation, it seems to me that either the new generation of coders are being being taught different, or the old ones are getting too anal about space. my question is... what in fact is the standard? perhaps we should have a poll on CodeProject and settle this once and for all!

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

        I had a programming class that was co-taught (2 hours per lecture, 1 professor per hour) and one used numero 1 and one used the second. Very annoying! Matt Newman
        What is your malfunction? - Dangeresque, too?

        1 Reply Last reply
        0
        • L lotuspro

          i've been chatting with the new guy at work today and he respectfully informs me he can't recall the last time he saw this notation: private void foo() { //statements } and contends that almost always people use: private void foo() { //statements } which to me is a total waste of a linebreak and less readable. worse still, the other new dude concurs? whassup with that? being a fan of the former notation, it seems to me that either the new generation of coders are being being taught different, or the old ones are getting too anal about space. my question is... what in fact is the standard? perhaps we should have a poll on CodeProject and settle this once and for all!

          L Offline
          L Offline
          Luis Alonso Ramos
          wrote on last edited by
          #28

          I've always, in the 12 or so years I've used C/C++/C#, used the braces on a line of its own, unindented. -- LuisR ___________   Luis Alonso Ramos   Chihuahua, Mexico   www.luisalonsoramos.com

          1 Reply Last reply
          0
          • N Nemanja Trifunovic

            private:
            void foo()
            {
            //statements
            }

            Company standard. Felt strange at first, but I got used to it, and now I use it everywhere


            My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

            C Offline
            C Offline
            caractacus
            wrote on last edited by
            #29

            Sorry, but this is anal. X|

            1 Reply Last reply
            0
            • L lotuspro

              i've been chatting with the new guy at work today and he respectfully informs me he can't recall the last time he saw this notation: private void foo() { //statements } and contends that almost always people use: private void foo() { //statements } which to me is a total waste of a linebreak and less readable. worse still, the other new dude concurs? whassup with that? being a fan of the former notation, it seems to me that either the new generation of coders are being being taught different, or the old ones are getting too anal about space. my question is... what in fact is the standard? perhaps we should have a poll on CodeProject and settle this once and for all!

              C Offline
              C Offline
              caractacus
              wrote on last edited by
              #30

              In my mind, both are valid!:omg:

              void foo() {
              if (!false) {
              burp();
              }
              }

              or

              void foo(
              int param1, // doc param 1
              int param2, // doc param 2
              int param3
              )
              {
              burp();
              }

              Why? I do not like CLOSING parentheses or braces lost on the end of broken/multi lines. Opening braces should be placed at the most logical point. You see, too many blanks/dim lines are just as detrimental as cramming.

              1 Reply Last reply
              0
              • N Nemanja Trifunovic

                private:
                void foo()
                {
                //statements
                }

                Company standard. Felt strange at first, but I got used to it, and now I use it everywhere


                My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

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

                Eeeuw. Anyone who finds this to be clear simply has difficulty thinking straight.

                1 Reply Last reply
                0
                • P peterchen

                  *must* *resist* *to* *flame* *Jörgen*


                  we are here to help each other get through this thing, whatever it is Vonnegut jr.
                  sighist || Agile Programming | doxygen

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

                  Bring it on! I've got skin made of asbest. ;) -- Denn du bist, was du isst! Und ihr wisst, was es ist! Es ist mein Teil...?

                  P 1 Reply Last reply
                  0
                  • L lotuspro

                    i've been chatting with the new guy at work today and he respectfully informs me he can't recall the last time he saw this notation: private void foo() { //statements } and contends that almost always people use: private void foo() { //statements } which to me is a total waste of a linebreak and less readable. worse still, the other new dude concurs? whassup with that? being a fan of the former notation, it seems to me that either the new generation of coders are being being taught different, or the old ones are getting too anal about space. my question is... what in fact is the standard? perhaps we should have a poll on CodeProject and settle this once and for all!

                    A Offline
                    A Offline
                    Allen Anderson
                    wrote on last edited by
                    #33

                    Version 2 is of course the only correct version. :) And I've worked in a lot of enterprise environments where I've never seen anything but v2 there.

                    1 Reply Last reply
                    0
                    • L lotuspro

                      i've been chatting with the new guy at work today and he respectfully informs me he can't recall the last time he saw this notation: private void foo() { //statements } and contends that almost always people use: private void foo() { //statements } which to me is a total waste of a linebreak and less readable. worse still, the other new dude concurs? whassup with that? being a fan of the former notation, it seems to me that either the new generation of coders are being being taught different, or the old ones are getting too anal about space. my question is... what in fact is the standard? perhaps we should have a poll on CodeProject and settle this once and for all!

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

                      I tend to use the 2nd format, but I wouldn't roll over and play dead if I saw the first. Imho, they're both readable and not worth getting into a religious discussion over. However, if you're talking about ham and Wonder bread or Maxwell House instant coffee (made with tap water and a microwave), I have some REALLY strong opinions. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

                      1 Reply Last reply
                      0
                      • L lotuspro

                        i've been chatting with the new guy at work today and he respectfully informs me he can't recall the last time he saw this notation: private void foo() { //statements } and contends that almost always people use: private void foo() { //statements } which to me is a total waste of a linebreak and less readable. worse still, the other new dude concurs? whassup with that? being a fan of the former notation, it seems to me that either the new generation of coders are being being taught different, or the old ones are getting too anal about space. my question is... what in fact is the standard? perhaps we should have a poll on CodeProject and settle this once and for all!

                        M Offline
                        M Offline
                        Marc Clifton
                        wrote on last edited by
                        #35

                        How do you line up the braces using the first notation? I occasionally (not too often) have nested levels where the second notation really helps me figure out where I am. With the first notation, how do you make sure all your braces match, and that they match in the places? (uh, yeah, I guess there's the IDE thingy that shows code blocks, but I actually don't really use that). Marc Microsoft MVP, Visual C# MyXaml MyXaml Blog Hunt The Wumpus RealDevs.Net

                        J 1 Reply Last reply
                        0
                        • J Jorgen Sigvardsson

                          Bring it on! I've got skin made of asbest. ;) -- Denn du bist, was du isst! Und ihr wisst, was es ist! Es ist mein Teil...?

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

                          Ohhh!!! I'll poke you till you give off some dust, then declare you an environmental health and cancer hazard! ;P


                          we are here to help each other get through this thing, whatever it is Vonnegut jr.
                          sighist || Agile Programming | doxygen

                          1 Reply Last reply
                          0
                          • M Marc Clifton

                            How do you line up the braces using the first notation? I occasionally (not too often) have nested levels where the second notation really helps me figure out where I am. With the first notation, how do you make sure all your braces match, and that they match in the places? (uh, yeah, I guess there's the IDE thingy that shows code blocks, but I actually don't really use that). Marc Microsoft MVP, Visual C# MyXaml MyXaml Blog Hunt The Wumpus RealDevs.Net

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

                            I just line up the if, for, whatever with the ending }. I used to be a v2 kind of guy, but for some reason I switched over (except for non-inline functions). It seems I'm the only one where I work. :) -- Denn du bist, was du isst! Und ihr wisst, was es ist! Es ist mein Teil...?

                            1 Reply Last reply
                            0
                            • N Nemanja Trifunovic

                              private:
                              void foo()
                              {
                              //statements
                              }

                              Company standard. Felt strange at first, but I got used to it, and now I use it everywhere


                              My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

                              P Offline
                              P Offline
                              palbano
                              wrote on last edited by
                              #38

                              :~ :puke: X|

                              All your braces are all belong to religion

                              1 Reply Last reply
                              0
                              • L lotuspro

                                i've been chatting with the new guy at work today and he respectfully informs me he can't recall the last time he saw this notation: private void foo() { //statements } and contends that almost always people use: private void foo() { //statements } which to me is a total waste of a linebreak and less readable. worse still, the other new dude concurs? whassup with that? being a fan of the former notation, it seems to me that either the new generation of coders are being being taught different, or the old ones are getting too anal about space. my question is... what in fact is the standard? perhaps we should have a poll on CodeProject and settle this once and for all!

                                J Offline
                                J Offline
                                Joey Bloggs
                                wrote on last edited by
                                #39

                                The first style is the ansi c standard and was invented at a time when we where all using 80 * 24 screens to code with ie saving lines onscreen was important. The second style is IMHO the more natural, intuitive, readable etc etc and whilst I can cope with both. The second style is all i have used for the last 15 ~ 20 years (unless forced at gun point by some anal coding standards nazi ;))

                                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