Common code indentation (follow-up to 2007 discussion)

Christian Stimming stimming at tuhh.de
Mon Jul 13 15:18:00 EDT 2009


Am Montag, 13. Juli 2009 20:53 schrieb Christian Stimming:
> After a short discussion on this topic in June, it seems to me everyone is
> more or less satisfied with the style proposed below. 

Actually, now that I've tried this on real code, I see some unexpected issues. 
Namely:

> -ppi4   Nested pre-processor defines are indented by four spaces

Those will always indent the #includes in headers by 4 spaces, like so

#ifdef _MY_FOO_H
#    define _MY_FOO_H
#    include <glib.h>

I don't like that. I would rather leave out -ppi4, giving the following 
command line:

indent -nut -i4 -ci4 -cli4 -nbc -nbfda -lp -psl -bbo -nsob -bad -bbb
-bap -fca -fc1 -sc -lc80 -npcs -nprs -ncs -saf -sai -saw -ss -brs -bl -bli0
-l90 *.h *.c

Also, I discovered more issues with indent-2.2.9: This version seems to insert 
a space after each asterisk `*' in pointer arguments, like so:

-gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc);
+gnc_hbci_gettrans(GtkWidget * parent, Account * gnc_acc);

Even more weird, there doesn't seem to be any option to switch this off or on. 
It just does this every time. I don't like this. 

And: When running the indent command several times on e.g. 
import-export/hbci/gnc-hbci-utils.h, in some comments a comment line will get 
an extra asterisk `*' at the beginning of the line, like so

- * NULL, job may be NULL (although in this case no HBCI result codes can be
+ * * NULL, job may be NULL (although in this case no HBCI result codes can be

Even more weird. Maybe we should consider another program, e.g. astyle? I 
could try to make up a proposal that matches what has been discussed but is 
given in astyle commands.

Regards,

Christian


More information about the gnucash-devel mailing list