Common code indentation (follow-up to 2007 discussion)

Christian Stimming stimming at
Fri Aug 28 16:35:06 EDT 2009

And eventually I learnt one more weirdness about the "indent" program:

Am Montag, 13. Juli 2009 21:18 schrieb Christian Stimming:
> 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.

"indent" will always surround the asterisk with spaces as long as it doesn't 
know the first word to be a type. Apparently, indent keeps a list of type 
names, to which we can add more names with the -T option. Only if the 
identifiert left of an asterisk is a known type, the asterisk will be written 
without a space on its right side:

$ indent *.h 

will give

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


$ indent -T GtkWidget -T Account *.h

will give

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

This bears the question of how indent ever was useful in a non-trivial 

> 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.

I'll try to find out suitable astyle arguments.



More information about the gnucash-devel mailing list