View Poll Results: What coding styles? [tick as many as you like]

Voters
46. You may not vote on this poll
  • K&R (bracket on same line as if but not for functions)

    10 21.74%
  • GNU (crazy indentation style)

    1 2.17%
  • Allman (brackets on their own lines)

    33 71.74%
  • Whitesmiths (completely retarded do not tick)

    1 2.17%
  • Hungarian Notation

    0 0%
  • Non-Hungarian notation (stupid microsoft).

    1 2.17%

Thread: Coding style?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212

    Coding style?

    What kind of coding styles do you adopt?

    edit: DAMMIT my poll is meant to have checkboxes, not radio buttons.
    Last edited by Brian; 10-19-2003 at 02:51 PM.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I don't really understand your poll. For instance, you could have brackets on their own line and use the hungarian naming convention.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Hence his comment of:
    DAMMIT my poll is meant to have checkboxes, not radio buttons
    Which was done a good amount of time before your post.

  4. #4
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Well, I'm not quite sure what category mine is:
    Code:
    // if / functions / classes / structs / loops:
    int blah(float one, char two) { //space between ) and {, but on same line, ", " seperating each variable
          statement; // instead of a space for an indent, I use tabs
    }
    Do not make direct eye contact with me.

  5. #5
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Allman all the way
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  6. #6
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    i can't really complete it without checkboxes... sometimes i put everything on one line, otherwise brackets get their own line...
    Code:
    int className::retVal(){ return returnedval; }
    int className::calcVal()
    {
         val+=2;
         return val;
    }
    also, I don't know what some of them mean...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  7. #7
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    I can't stand brackets having their own line, it looks messy to me

  8. #8
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Originally posted by glUser3f
    I can't stand brackets having their own line, it looks messy to me
    That's weird. Completely opposite to most people. The only reason for having them on the same line is to save space and be able to see more lines at one time. Giving them their own line gives a clearer picture of the code block.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  9. #9
    root
    Join Date
    Sep 2003
    Posts
    232
    >Giving them their own line gives a clearer picture of the code block.
    Because indention is horrible for that purpose. We should inform Python users before any more damage is done.
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

  10. #10
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Having brackets on their own lines in combo with proper indentation makes it a lot easier to match up brackets.

    Now who uses spaces instead of indents? I do...now

  11. #11
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Because indention is horrible for that purpose.
    uh... I said "clearer", as in better than just indenting.

    aka: in addition to, as well as, also, with, adjacent to, etc...

    Code:
    if(blahblahblah){
       //stuff
       //is second line part of a block? or what?
    .
    .
    .
    It just defines the block more clearly.
    Last edited by FillYourBrain; 10-20-2003 at 07:48 AM.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  12. #12
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Now who uses spaces instead of indents? I do...now
    yup. A company I worked for had that in their coding standards so I adopted it.

    edit: fortunately visual studios has a setting that makes tab insert spaces instead of tab characters. That has made my life easier.
    Last edited by FillYourBrain; 10-20-2003 at 07:51 AM.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  13. #13
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Originally posted by glUser3f
    I can't stand brackets having their own line, it looks messy to me
    Yay someone else agrees!!!
    Do not make direct eye contact with me.

  14. #14
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Allman non Hungarian. The professionals choice.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  15. #15
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    Originally posted by FillYourBrain
    That's weird. Completely opposite to most people. The only reason for having them on the same line is to save space and be able to see more lines at one time. Giving them their own line gives a clearer picture of the code block.
    Hmm, I prefer to put empty lines where I need them, not because I just started another loop.
    And matching brackets is just as easy:
    Code:
    -    for (int i = 0; i < SIZE; i++) {
    |          -  if (done) {
    |          |          break;
    |          -  }
    -    }
    This is just my opinion, maybe bacause the fist book I ever read about programming used the coding style, don't know.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is it bad style of coding ??
    By noobcpp in forum C++ Programming
    Replies: 15
    Last Post: 11-06-2008, 10:39 AM
  2. Your Coding Style?
    By Krak in forum A Brief History of Cprogramming.com
    Replies: 45
    Last Post: 06-02-2005, 08:19 AM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  4. Coding style
    By Clyde in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 04-09-2002, 04:22 PM
  5. coding style
    By ActionMan in forum Linux Programming
    Replies: 1
    Last Post: 10-03-2001, 07:36 AM