GNU is acceptable if it's using either tabs or spaces, but not both.
Allman is acceptable.
K&R is king.
Name:
Anonymous2009-07-29 12:45
>>-
Please observe official /prog/ style from now on. Thank you.
static char *concat
(
char *s1, char *s2
)
{
while
(
x == y
)
{
something();
somethingelse();
}
finalthing();
}
Name:
Anonymous2009-07-29 12:45
(modified?) Allman style, two spaces, without omitting braces even in single statements, and the three-line else. Yeah, call it waste of space, I don't give a flying Philadelphia fuck.
I was looking at styles earlier, and I don't see why there are no common/official styles that appeal to me. I was about to say that I use BSD style, but then I noticed that it has Java-style else statements.
for (int i = *yumyums; i > 0; i--) {
result = i * i;
result = i ^ result ^ 0x55;
if (result > 0x50000000) {
results.push_back(result);
}
else {
i++;
}
}
}
>>26
Do those that use See/Sepples actually write code like that in production environments? If so, you're a fucking liability to any company that has the misfortune of hiring you.
>>27
No. Those that code in any language within a group follow that group's style guidelines regardless of their personal preferences.
Of course, you'd know this already if you had ever programmed for a living.
>>30
Clearly. The prompt is "how do you indent" and he claimed to have fixed the code. "How do you indent" very obviously implies "how do you indent [when you have control of a project's style]"!
If he were to start a project for hire, it's probable that he would have the ability to set the style guidelines and would actually write code like that. That is a liability and it has nothing to do with conformance to style guidelines put forth by others due to the nature of the prompt.
>>31 If he were to start a project for hire, it's probable that he would have the ability to set the style guidelines and would actually write code like that.
That's right. I would code like >>26 . I find nothing wrong with that style. If you want to work with me as your project manager, you should at least be able to understand that.
If you find it hard to read code just because there's no whitespace around the operators then I don't need you in my project, since you've obviously haven't been exposed to enough code styles.
Ideally, every C/++ programmer should be able to at least use and understand K&R, Allman, and GNU.
>>32
And when your ass is dead, your code that entirely lacks maintainability is nothing but a burden. That makes you a shitty programmer and nobody needs you.
Name:
Anonymous2009-07-29 16:27
>>1
It's widely accepted that anyone who seriously proposes anything remotely similar to the GNU bracket placement, including the GNU coding standards themselves, are obvious trolls.
My personal theory is that RMS introduced them in an attempt to uglify C enough to make it look inferior to Lisp. He failed, and the people WHBT went forth and spread one of the most disgusting indentation styles known to humanity short of random.
Name:
Anonymous2009-07-29 16:27
>>34
Code doesn't lack maintainability because of style*. It lacks maintainability because it was horridly designed or because there aren't enough comments. Magic numbers and hacks also help.
*Except in extreme cases. See >>33 . On the other hand, there are code beautifiers.