|
|
|
![]() |
|
|||||||
|
||||||||
| View Poll Results: Who uses white space? | |||
| Yes, i make it so people can read my code |
|
39 | 69.64% |
| Yes, i make it so i think that others can resd it |
|
7 | 12.50% |
| No, only I can read my code |
|
3 | 5.36% |
| I think that only i can read my code |
|
3 | 5.36% |
| I don't understand the question. |
|
4 | 7.14% |
| Voters: 56. You may not vote on this poll | |||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: "White space"
I love white space. I do stuff like this:
Code:
function(
int parameter 1 , //comment
int parameter 2 , //comment
...
word parameter20 ) //more comment
Code:
function(int parameter1,int parameter2, ... word parameter20) |
|
#2
|
|||||
|
|||||
|
Re: "White space"
Quote:
Now, if a line is getting too long, I will break it between parameters to for readability. And no, I haven't had anyone complain about not enough whitespace yet. The parameters for my C++ class last semester were something like 1 extra line between groups of lines (say, between 2 for loops) and 3 lines between functions, plus the comment lines. I think I had about 650+ lines for a "voting machine" program, including whitespace and comment after comment after comment--and throw in some code for good measure. ![]() Actually, one quote I've seen on here in the spotlights is: "A programmer's job is to write documentation that just happens to compile.", or something like that. Because it's documentation, it needs to be readable. I'd have a hard time reading the code above, due to the fact that having all the parameters separate from the header makes them look like variable declarations within the function. That's probably why they're complaining--they can't tell whether or not you're declaring variables or parameters. If you do do it this way, you might want to indicate in the comment that it's a parameter before anything else. |
|
#3
|
||||
|
||||
|
Re: "White space"
Quote:
![]() |
|
#4
|
|||||
|
|||||
|
Re: "White space"
Quote:
Then again, you should see some of my if statements and the conditions in them... |
|
#5
|
|||
|
|||
|
Re: "White space"
I would like to bring up the topic of the ternary operator. For those of you who do not know, in C you can use a?b:c; and have it as a completely valid statement so for example:
Code:
int foo(int bar)
{
return bar>0?1:-1;
}
|
|
#6
|
|||
|
|||
|
Re: "White space"
ternary operator=blech. The problem with it is even if you know what it does(which not everyone does), I prefer syntax that actually reflects the logic of the process(like a standard if/else)
As for whitespace--I am known among some people for writing "MLA code"--basically, I code the same way that I would right an essay, with indents, paragraphs, etc. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Championship Event - Where the "Random" Match Sorting Really "Shines" | Travis Hoffman | Championship Event | 57 | 19-04-2007 08:06 |
| New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" | Jessica Boucher | Team Organization | 0 | 10-08-2005 10:55 |
| Team 1126 "Crazy Wheels" white paper | Alex Cormier | Technical Discussion | 1 | 25-10-2004 15:54 |
| "Thunderbirds" Vs. "Team America" Which one will rule the box office? | Elgin Clock | Chit-Chat | 3 | 07-09-2004 19:53 |
| Transcript: "The Space Shuttle Columbia Accident: What's Next?" | DanL | General Forum | 2 | 03-03-2003 21:35 |