View Poll Results: Whitespaces...

Voters
53. You may not vote on this poll
  • for(x=0;x<5;x++)

    13 24.53%
  • for (x = 0; x < 5; x++)

    35 66.04%
  • for ( x = 0 ; x < 5 ; x++ )

    5 9.43%

Thread: White spaces

  1. #16
    Registered User cody's Avatar
    Join Date
    Sep 2001
    Posts
    86
    I'll go with too, two
    #include "reallife.h"

  2. #17
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Well, I think it's ananomys. #2 is the best and most used.

  3. #18
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    well, it must change depending where you live on: everyone I know (who knows programming), uses #1

    Oskilian

  4. #19
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    ok i have been programming since before you people knew what it was...ok some of you anyway, ok about 3 of you, but i've been programming for at least (and i can't even remember since my brain is on fire right now...) 3+ years and i've read code from most of the damn Guru's and about a million other people and heres my opinion,including my own

    #1 error prone during reading, you might miss something
    #2 just right everythings clear and plain, and it can be read quickly.
    #3 over spaced, makes it harder to read.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  5. #20
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Listen to no-one. He knows what he's talking about. #2 is just the perfect coding practice.

  6. #21
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    I agree, #2 is the nicest, but I've grown with #1, so there's nothing I can do about it

    By the way, you did programming since 3+ (is that 18?), were you doing Logo?

    Oskilian

  7. #22
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584

    Can I get a mod here?

    Hey, all of you of this thread. Go to the C board and look at the thread entitled "Interesting little exercise...". There is this Unregistered guy that is attacking me. I am just trying to help and he is critisizing me out of no where. Can I get a mod here to do something? Thanks.

  8. #23
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Never mind. A false alarm. He was just sticking up for me. I feel stupid.

  9. #24
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    >
    By the way, you did programming since 3+ (is that 18?), were you doing Logo?
    <

    what...huh.

    i said i've been programming for 3+(eg. 3 or more) years, but as for languages i was refering to C/C++.

  10. #25
    Registered User Camilo's Avatar
    Join Date
    Oct 2001
    Posts
    78
    I use #1, it is fast, but you are right, you can miss something while debugging, but if you learned in a way, why would you change it?



    Camilo
    no, life is nice, just a girl fooling around, alcohol fixes everything.
    OH, I now have a High School Diploma and need of ron (drink)

  11. #26
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    i had to change to 2 from 1. i also changed from adding more whitespace to my code to increase readability... however. what about this case?

    Code:
    if ((a - b) == (c - d));
    *or*
    if ( (a - b) == (c - d) );
    i end up doing the first, but like to do the second since it seems more readable... however contradictory... so the point being the nested parenthesis...
    hasafraggin shizigishin oppashigger...

  12. #27
    Registered User
    Join Date
    Sep 2001
    Posts
    412
    I use #2. Not too much whitespace, not too little. I do vary my practices when I have many levels of parantheses, I space them until I can see at a glance how parentheses pair. I don't have a fixed rule for them, per se.

  13. #28
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I use #1. But sometimes you have to watch out or you get something you were not expecting.
    ie
    What if you are passing around pointers and want to divide with it? (not a 100% example, just a quick demo)


    Code:
    int  MyFunct(int *iInt)
    {
         int   iNew=0,iTwo=2;
        
         iNew=iTwo/*iInt;//  /* is the same as // (but we all knew that)
    }
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  14. #29
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I use #1, but should probably use #2 because it is easier to read.

  15. #30
    free(me);
    Join Date
    Oct 2001
    Location
    Santo Domingo, DN, Dominican Republic
    Posts
    98

    ...

    Code:
    int myFunction(int arg1, int arg2, ... int argN)
    {
        int i;
        for(i = 0; i < arg1; i++)
        {
            /* source code */ 
        }
    
        return argN;
    }
    That's how i like to do it.

    adios,
    biterman.
    Do you know how contemptous they are of you?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading white spaces? oh and scanf_s
    By RobotGymnast in forum C++ Programming
    Replies: 7
    Last Post: 11-01-2008, 05:32 AM
  2. white spaces ...
    By eagles in forum C++ Programming
    Replies: 6
    Last Post: 01-13-2006, 07:55 AM
  3. Replies: 1
    Last Post: 03-08-2005, 12:02 PM
  4. string input...with white spaces?
    By Pureghetto in forum C Programming
    Replies: 6
    Last Post: 03-10-2003, 01:52 PM
  5. Reading in text file into an array, white spaces...
    By error in forum C++ Programming
    Replies: 12
    Last Post: 01-14-2003, 09:39 AM