Re: indentation of c code

i tried to play with gnu indent but i dont like some specific parts,

some_function_with_a_very_long_name (GtkWidget *widget, GdkEvent event,
                                     gpointer data)
-> either i would put every argument on its line or all of those on just
   1 line..

    primary =
        g_strdup_printf (_
                         ("some long text %s"),

-> sorry, but no sane programmer would do stuff like that...

    command_line =
      g_strdup_printf ("gnome-open mailto:?subject='%s'", _("Media
-> same as above

        gtk_action_group_set_sensitive (cheese_window->actions_flickr,
        gtk_action_group_set_sensitive (cheese_window->actions_fspot,

-> why should the last TRUE be on a separate line if those above arent?

and so on.. mostly the problems are with long lines, where the logic is
more important than a strict rule, which says you dont have to go above
a certain limit (as the -l parameter does)

my settings to get the above were:

indent file.c -i2 -psl -di0 -bl -bli0 -nce -d0 -cli0 -pcs -nfc1 -nut -lp
-hnl -nbbo --ignore-newlines -T GtkWidget -T GtkWindow -T
CheeseWindow ....

would be great if someone could help me with this!


On Mo, 2008-08-18 at 08:52 +0200, BJörn Lindqvist wrote:
> 2008/8/17 daniel g. siegel <dgsiegel gmail com>:
> > hi all!
> >
> > i just wanted to know if someone out there has already an option file or
> > a small script for gnu indent to indent c code to the "gnome standard"?
> There is no GNOME standard for indenting C code -- every project use
> their own indentation style (unfortunately). But to reformat a file to
> an indentation style many projects use, you can just run "indent"
> without any arguments.
this mail was sent using 100% recycled electrons
daniel g. siegel <dgsiegel gmail com>
gnupg key id: 0x6EEC9E62
fingerprint: DE5B 1F64 9034 1FB6 E120 DE10 268D AFD5 6EEC 9E62
encrypted email preferred

Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]