cleanup specfile for packaging
[profile/ivi/cogl.git] / doc / CODING_STYLE
1 Cogl Coding Style
2 --------------------
3
4 This document is intended to be a short description of the preferred
5 coding style to be used for the Cogl source code.
6
7 Coding style is a matter of consistency, readability and maintainance;
8 coding style is also completely arbitrary and a matter of taste. This
9 document will use examples at the very least to provide authoritative
10 and consistent answers to common questions regarding the coding style,
11 and will also try to identify the allowed exceptions.
12
13 The Cogl coding style is currently defined relative to the Clutter
14 coding style, so please first read clutter/docs/CODING_STYLE.
15
16 Differences to the Clutter coding style:
17
18 + Headers
19
20 Cogl headers are not exempt from the 80 characters limit as they are in
21 Clutter. Function prototypes should not be arranged into vertical
22 columns but should instead follow the "+ Functions" section of the
23 Clutter CODING_STYLE like:
24
25 void
26 my_function (CoglType     type,
27              CoglType    *a_pointer,
28              CoglType     another_type);
29
30 + Types
31
32 Avoid the use of redundant glib typedefs and wherever possible simply
33 use ANSI C types.
34
35 The following types should not be used:
36   gint, guint, gfloat, gdouble, glong, gulong, gchar and guchar
37 Instead use:
38   int, unsigned int, float, double, long, unsigned long, char, and
39   guint8/unsigned char
40
41 The glib types that we continue to use for portability are gboolean,
42 gint{8,16,32,64}, guint{8,16,32,64} and gsize. When ever you need a
43 byte size type for dealing with pixel data then guint8 should be used.
44
45 The general intention is that Cogl should look palatable to the widest
46 range of C programmers including those outside the Gnome community so
47 - especially for the public API - we want to minimize the number of
48 foreign looking typedefs.
49