My opinion is that the Allman style is better than any other. Other styles are inferior to Allman style in regards of readability and I would prefer to work with code in Allman style only.
Thus, I find the need for a utility to convert the text in a set of files into the Allman style necessary.
Would any of you know if such a utility exists? Is there even an extention to emacs that could do this?
int
main(argc, argv)
int argc;
char **argv;
{ printf("Best indentation style.\n");
return 0; }
Name:
Anonymous2010-10-10 16:47
I never paid any attention to it, but I seem to use a variation of Allman style. I don't space between method names and their argument parentheses, occasionally I mash comma-parameters together and arithmetic operators closer, the latter usually in the case of index calculation. I also sometimes one-line certain statements.
int vagueExample(int x, int y)
{
if(y < 0) return something(x,y); // 'for' and 'while' loops too
else y = somethingElse(x);
return something(x,y);
}
If I'm just reading, I don't care how other people indent (as long as it's not flush-left, or something equally dumb and useless like GNU style), but the moment I have to change something, I run astyle -A10 -s8.
My style? (The else part is a bit forced for completeness' sake.)
/*
hax :: String -> String -> Int
Takes an anus along with a compatible signal
and applies a codan determined by the signal.
*/
int hax(char *anus, char *signal)
{
int i;
signal *sig;