Journal buffer-overflowed's Journal: Grrrr.... K&R Brace style.... Not.... Valid!? 28
Ok, I'm ashamed to admit, I was helping someone(not anyone here) with their CS homework(C++).
Basic 4 function calculator type level stuff. So they send it off to me, and I go about fixing it and commenting what I changed and why. Of course in the process I cleaned up the bracing which was, well, bad. Ok, all fixed now...
Person sends it off to the professor for input. Professor responds back good yada yada but the bracing is bad.
I use K&R, apparently a heresy within the hallowed halls of podunk academia. Bastards.
Buffer smash.
Question (Score:1)
Re:Question (Score:1)
}
int main (int argc, char *argv[]) {
}
if (something) {
} else {
}
Re:Question (Score:1)
UGH! THAT SUCKS! (Score:2)
When you are looking at shit code with switch/case statements that go for pages or just procedures that go on for years (or worse, nested classes) having "All your ducks in a row" is a god send. (no, i don't use tools that will show you where the matching braces are, those are for sissies who don't like to debug)
Re:UGH! THAT SUCKS! (Score:1)
Re: (Score:2)
Re:UGH! THAT SUCKS! (Score:1)
But really, saying that a "bracing-style" is wrong is just stupid. It's the content that matters, not the bracing style. Well, as long as it is readable. Putting all code in one line might piss me off too ;-)
Isn't there a C/C++ plugin for Eclipse? Eclipse reformats Java to any style you wish. It even is fully configurable.
Re:UGH! THAT SUCKS! (Score:1)
Re: (Score:2)
Re:UGH! THAT SUCKS! (Score:1)
Anyway, my CS profs wouldn't have called it bad or improper, the just would've altered the specs to include things like this.
Re:UGH! THAT SUCKS! (Score:1)
Buffer, we are a dying breed. Terminal window? Bah, kids these days use these fancy guis and ides to edit their so called code. Kids don't realize that screen space is is precious real-estate. They waste it with porn instead of treasuring each pixel as of their 80x24 screen for programming code. Fools. No wonder we have such bloat now in our programs, they can't even keep the bloat out of the uncomplied code, full lines for an opening brace!
Re:UGH! THAT SUCKS! (Score:2)
I use an IBM 3151 GREEN SCREEN. Yeah, mutherfucker, thats right. WITH VI. (none of that vim crap)
I am HAAAD 2-D KAW.
And ESPECIALLY when you are on a green screen, you (meaning: I) need the braces to match up.
Dying Breed? I bet you don't even code in assembler anymore! Sucka MC. I got the shit on lock right down to the metal. (or, poly-silicon. whatever.)
Ahhhh!! (Score:1)
Re:Ahhhh!! (Score:2)
-Olaf
Re:UGH! THAT SUCKS! (Score:2)
Besides, how is K&R (in buffer-overflowed's example) different from The Java coding standards [sun.com]?
Yes, switch statements are unnecessary and I have grown to like the Java naming convention [sun.com] (forgot the name of the caps one) versus the underscore convention.
Did I miss your point somehow? be gentle
My preference... (Score:1)
My coding style (Score:2)
while (condition)
{
}
int main (int argc, char *argv[])
{
}
if (something)
{
}
else
{
}
Of course, I am just now getting around to learning to code. Before this year, I was purely an assembly person. My code ends up pages and pages long, but it certainly helps to keep me straight while I am learning.
Re:My coding style (Score:1)
Re:My coding style (Score:1)
gnu indent [gnu.org]
It will format format the code quite nicely and you have a number of options, one being the k&r style or the style you have above. Other options are how many spaces for indent (or tabs).
If you have to work with java code, jalopy [sourceforge.net] is an excellent program for formatting. It can choke up on java docs though, so be careful with html tags in javadocs.
Re:My coding style (Score:2)
Re:Question (Score:2)
-Ab
Re:Question (Score:1)
3, wtf three spaces? What unnatural programming style. God meant for us to use tabs for a reason, you can control what a tab is with your editor (3 spaces if you like, or 8 like a normal human, or 4 if you are new age). My boss uses 3 spaces (and hence our programming style for our company), it drives me nuts! What is the logic of three spaces? And odd number?!?
Re:Question (Score:1)
It's like a machine gun in burst mode. You have single-shot, burst (3), or full auto. It comes from programmer's latent agression.
The above is completely balderdash.
Re:Question (Score:1)
Re: (Score:2)