[Parted-edge] [PATCH] Create the needed infra-structure to enforce the coding style

Otavio Salvador otavio at debian.org
Sun Oct 14 03:06:35 UTC 2007


"Debarshi 'Rishi' Ray" <debarshi.ray at gmail.com> writes:

>> uncrustify looks promising:
>>
>>   Source Code Beautifier for C, C++, C#, D, Java, and Pawn
>>   http://uncrustify.sourceforge.net/
>
>
> Here is the configuration file that I used in the following command:
> http://rishi.fedorapeople.org/gnu/gnu-indent.cfg
>
> uncrustify -c /devel/gnu-indent.cfg --replace -l CPP `find . \( -iname
> '*.[ch]' -o -iname '*.[ch]pp' -o -iname '*.cc' \) -print`
>
> Here is the effect this has on the C++ code:
> http://rishi.fedorapeople.org/gnu/bindings-uncrustify.patch
>
> The GNU style of having "newline between return type and function name
> in definition" seems to be problematic since uncrustify is not
> differentiating between method declarations and definitions.
>
> Uncrustify comes also with a default set of options for the GNU coding
> stadards: http://rishi.fedorapeople.org/gnu/gnu-indent-default.cfg
>
> I tried to keep as close to it as possible.
>
> Comments?
>
> Happy hacking,
> Debarshi
> -- 
> GPG key ID: 63D4A5A7
> Key server: pgp.mit.edu
>

First, I'd like to add that I'm using uncrustify here at the work too
and one of most nice things about it is that upstream is really
great. He's very helpful :-)

Few comments about the style itself:

+Alignment::~Alignment ()
+{
+  if (alignment_)
+    {

Personally, I dislike it! I prefer:

+Alignment::~Alignment ()
+{
+  if (alignment_) {
...

Another:

+namespace Ped
+{
+class Alignment
+{
+  friend class Constraint;

I prefer:

+namespace Ped
+{
+  class Alignment
+  {
+    friend class Constraint;

Personally I think we need to "enforce" the style on uncrustify so it
does the changes on the code instead of doing it on some cases.

Besides that, it rocks! :-)

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the Parted-edge mailing list