[ros-kernel] Re: Coding style/indentation (again!?)

Martin Fuchs martin-fuchs at gmx.net
Sat Jan 31 09:32:55 CET 2004


> ROS' lack of coding style is still bugging me, so here we go again:
> 
> First we have to agree on a coding style.

Questions about a common coding style are very difficult.
You won't be able to find a common style most of the time.

Your proposal to use indent in CVS scripts will cause more problems than
it can resolve. Getting conflicts when commiting changes whould be avoided
in any case. Revoking commits only because they don't conform to some
styling are also very problematic.

I think the only reasonable option to get better coding style/formating is
to correct it _one time_ for any source file, and commit this into CVS.
May be this is not needed for any file - only files with inconsistent styles
have to be touched.
After this procedure any one should try to use the same coding/formating style
like in the file he is changing. This will avoid much trouble. If some one doesn't
obey the rules, the file can be reformated later any time.


> Here's my suggestion: indent <file> -gnu -nut -bli0 -cbi0 -cli3 -bfda -i3
> -l100 -npcs -cdw

I tried your suggested indent command, and found a few problems with it.
Also the manual page explains, indent doesn't handle C++ code.
I get ugly indentation like this:

struct BackgroundWindow:public SubclassedWindow
{
   typedef SubclassedWindow super;

     BackgroundWindow(HWND hwnd):super(hwnd)
   {
   }

 protected:
     LRESULT WndProc(UINT nmsg,
                     WPARAM wparam,
                     LPARAM lparam);
};

However currently Explorer is the only part in the ReactOS tree, which uses C++.
(And I don't think it's indentation has to be corrected - I tried to write the code in a
readable style.)


Regards,

   Martin



More information about the Ros-kernel mailing list