Re: Style Guidelines
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Subject: Re: Style Guidelines
- Date: 03 Aug 2000 09:27:51 -0400
Tor Lillqvist <tml@iki.fi> writes:
> Havoc Pennington writes:
> > Function prototypes have to be lined up in the way you see in all the
> > GTK headers, we have an Emacs macro to do that.
>
> Argh. I have been doing it manually (well, open-rectangle and
> kill-rectangle help a lot). Where can I find this macro?
http://people.redhat.com/otaylor/egtk.el
> > The * of a pointer declaration is next to the variable name, e.g.
>
> But for instance the Pango headers don't follow this? Is the rule
> different for pointer functions?
For variables, and for function arguments, the rule is absolute:
gchar *str;
For functions returning pointers, and for isolated types in casts,
there is a little more variation and lack of agreement.
My general style is:
GdkWindow *blah_get_window ();
char * blah_get_string ();
(char *)foo;
But you'll also find:
GdkWindow *blah_get_window ();
char *blah_get_string ();
(char *) foo;
And even:
GdkWindow* blah_get_window ();
char* blah_get_string ();
(char*) foo;
Elsewhere in GTK+ [ Though for Pango, the third set is not
allowed. ]. So you could probably get away with any of them.
(Actually, you probably should go with '(char *) foo' over '(char
*)foo', since I don't object to the first, and Tim does object to the
second.)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]