This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
> Just the same, it's unrealistic to implement many of the algorithms in > gcc with only three indentation levels, so it's just wrong to declare > that as a strict rule, and arrogant to say that those who violate it > are bad programmers. Sometimes it appears that Linus's success and > fame has gone to his head a bit. Just to set this straight: Linus never said that gcc developers were bad programmers (or please show me a quote). His posting in question was clearly marked as being `religious', and specifically about _his own_ coding standard (which is obviously aimed at kernel development): Date: Fri, 3 Feb 1995 12:38:51 +0200 From: Linus Torvalds <Linus.Torvalds@cs.Helsinki.FI> Message-Id: <199502031038.MAA27879@keos.Helsinki.FI> Subject: Re: Coding Standards, anyone? ... > I do have a standard of my own, BUT.. I know this is religious, and > when it comes to device drivers that I don't expect to be able to update > anyway and code like that, I allow almost any coding standard the author > wants to use, as he's the one that will have to keep it up. If somebody > else takes over (and the original author obviously doesn't keep it up > any more), the new person is free to change the style. I'm happy to say > that this has happened only a very few times. > > Anyway, here's my standard in a nutshell, with comments (and if I don't > always adhere to it 100%, it's only because sometimes I'm lazy too, but > you'll find it true for almost all code I write): ... > Coding style: > - not more than 4 levels of indentation, preferably not even more than > three levels. ... > There are *very* few reasons to break any of the above. Just about the > only good reason is to go beyond the function length limit: some > functions are inherently "flat" (ie only a few levels of indentation) > and obvious, but tend to be rather long just because it has a lot of > equivalent cases that need testing. This may be due to bad programming > (trying to make one function do many things), but it can also be simply > due to external circumstances (you get input you have no control over > and have to make decisions upon that). ... > Anyway, this got longer than I intended it to be, and most of it is > religious. Ignore it if you wish, but you'll be sorry ;-) I cannot see the declaration of strict rules or even arrogance in this `sermon'. One shouldn't take _everything_ Linus says too seriously. Regards, Wolfram. -- `Surf the sea, not double-u three...' wmglo@dent.med.uni-muenchen.de
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |