[En-Nut-Discussion] Tons of trailing spaces in our source code

Ulrich Prinz uprinz2 at netscape.net
Sun Oct 17 15:41:01 CEST 2010


Hi!

Am 17.10.2010 15:19, schrieb Thiago A. Corrêa:
> Hi,
>
>      I also use Visual Studio as source code editor, like Harald. As
> far as I'm concerned, I don't see any problems with the whitespaces at
> line endings at all. They don't cause me conflicts, they are
> completely invisible in the source editor and I usually run svn diff
> from tortuise before commiting and revert any spurious changes like
> simple trailing spaces differences.

Yes but others use Notepad++ oder SourceInsight and they don't like to 
first diff, then revert, then ...
So it should be no problem to once remove all trailing spaces and then 
keep care not to introduce new ones. Even if there are plugins, like 
Harald told, that keep care about that.
>
>      But I don't agree much with the tab ->  space. Using tabs has the
> advantage that you can setup your source code editor to display it
> with the indentation that you prefer. Even on vi, you can just set
> ts=4 or whatever value you like.
>
Yes, I fully agree! But Nut/OS has been told to not use TABs and so we 
either need to change that decision and one time convert everything or 
we need to keep up the rule and clean up.

>      Automatic source identation tools usually mess up with the
> switch() clauses, so if we use it, we better review the results
> carefully. Just my 2 cents.
>
It is not problematic as long as the compiler doesn't get puzzled. For 
me it is fully ok to write
switch (a) {
   case 1: b=5; break;
   case 2: c=7; break;
   ...
}

as this is easy to read, and not blowing up the pages. You justt get 
more to see on your screen. But if there are two or more lines of code 
between case and break then you should put it to separate lines.
'Should' is to bread like in datasheets: should = must!

Best regards
Ulrich



More information about the En-Nut-Discussion mailing list