FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » Allman forever!

   
Author Topic: Allman forever!
Bekenn
Member
Member # 6602

 - posted      Profile for Bekenn   Email Bekenn         Edit/Delete Post 
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....

Posts: 293 | Registered: Jun 2004  |  IP: Logged | Report this post to a Moderator
Speed
Member
Member # 5162

 - posted      Profile for Speed   Email Speed         Edit/Delete Post 
Yeah! Live at Fillmore East is one of the greatest albums of all time!

Too bad Duane died.

Posts: 2804 | Registered: May 2003  |  IP: Logged | Report this post to a Moderator
KarlEd
Member
Member # 571

 - posted      Profile for KarlEd   Email KarlEd         Edit/Delete Post 
I wikied it, and I now know what K&R is, but I still don't think it "get" it. [Frown]
Posts: 6394 | Registered: Dec 1999  |  IP: Logged | Report this post to a Moderator
Bekenn
Member
Member # 6602

 - posted      Profile for Bekenn   Email Bekenn         Edit/Delete Post 
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.

Posts: 293 | Registered: Jun 2004  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
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.

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

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