This is topic Allman forever! in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=037517

Posted by Bekenn (Member # 6602) on :
 
Down with K&R!

...

Note: This is something only programmers are going to get. If you're not a programmer and you're really curious, look it up on Wikipedia.

I've been getting more and more frustrated with my employer's use of K&R throughout all of the code that I'm expected to maintain. It's silly. It's stupid. I shouldn't let it get to me.

But any time I see it... I just have to change it. I can't stop myself. Maybe I need help, or a twelve-step program for Allman junkies.

Oh, yeah... and he never puts spaces between operands and operators. Ever.

Just had to vent....
 
Posted by Speed (Member # 5162) on :
 
Yeah! Live at Fillmore East is one of the greatest albums of all time!

Too bad Duane died.
 
Posted by KarlEd (Member # 571) on :
 
I wikied it, and I now know what K&R is, but I still don't think it "get" it. [Frown]
 
Posted by Bekenn (Member # 6602) on :
 
Allman style:
code:
if(something.IsTrue())
{
DoStuff();
DoMoreStuff();
}

K&R style:
code:
if(something.IsTrue()) {
DoStuff();
DoMoreStuff();
}

As I said, pretty trivial. It's just a question of where you put that opening brace. Nonetheless, brace styles have sparked many a holy war between coders who might otherwise be able to co-exist in peace and harmony.

I.i Yea, Verily, said the Great Allman, Thine opening and closing braces shall line up, and the code that thou dost write shall be indented between them. ii And there was a great cheer from the coders huddled there, for they saw that this was good. iiiWoe be unto him who writeth his code with the opening brace on the same line as the control statement, for this is folly and leadeth to many headaches.
iv Verily I say unto thee, said the Allman, there shall come coders who practice the ways of evil, v and they shall write their control statements with many characters, such that the end of the statement falleth off the edge of thy screen, and the opening brace shall thusly be hidden from you. vi Do not be like those foul tricksters, but instead shalt thou write maintainable code. vii And there was much rejoicing.
 
Posted by fugu13 (Member # 2859) on :
 
For properly indented code, K&R style is much more readable, IMO.

But its not like you can't set up your editor to switch to Allman style, and then switch it back to K&R style before you commit if your employers insist on it.
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2