>I strongly disagree on using anything that resembles K&R.
> Where I work you could get reprimanded and maybe even fired if you did
use it.
So are you saying that
if (x == y) {
x++;
} else {
x--;
}
is a serious offence where you work? If it is, I'd love to know the
logic behind the argument.
Where I work, we support several styles, so long as only one style is
used in any particular file. I have my favourite, others have theirs. We
respect our differences. It doesn't negatively affect productivity.
On Mon, 2011-08-29 at 19:45 -0400, Michel Catudal wrote:
> Le 29/08/2011 12:28, Eric Wetzel a écrit :
> > For the record, here are the relevant standards:
> > GNU: http://www.gnu.org/prep/standards/standards.html#Writing-C
> > Kernighan& Ritchie:
> > http://en.wikipedia.org/wiki/Indent_style#K.26R_style (sorry, didn't
> > try very hard on this one)
> > Linux: http://www.kernel.org/doc/Documentation/CodingStyle
> >
> >
> I strongly disagree on using anything that resembles K&R.
> Where I work you could get reprimanded and maybe even fired if you did use it.
>
> for example something like this is not only unacceptable, you will get a
> reprimand.
>
> if (x == y)
> x++;
> else
> x--;
>
> this is also unacceptable
>
> if (x == y) {
> x++;
> }
> else {
> x--;
> }
>
> This must be used even if there is only one line of code. Unless you're
> compiling with a TRS-80 you shouldn't be concerned about the added time for
> compiling.
>
> if (x == y)
> {
> x++;
> }
> else
> {
> x--;
> }
>
> The reason is for clarity. It is true that the code is easier to follow this
> way.
> When I take code from open source and want to go thru to understand it, I
> often have to load the file in slickedit and do a beautify to make the code
> more readable as it is often stuck in that old K&R coding style which I
> cannot stand.
>
>
> Since we have bigger monitor than in the 70s and 80s why make the code
> unreadable?
> The only valid reason for using K&R would be
> 1- You still expect to be stuck with a teletype at times and want to make
> sure you can see many lines of code at once
> 2- You can't get yourself to replace your VIC-20 or TRS-80.
> 3- You are still stuck with a tiny 13 inches or smaller screen.
>
> Michel
>
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development