From 9cc248a1aff11af92902093d2991e462f36f72fa Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 29 May 2018 13:40:20 -0300 Subject: [PATCH] docs: Improve code style guideline --- docs/HACKING.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/HACKING.md b/docs/HACKING.md index cf9265f50..880c3fcd5 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -23,6 +23,48 @@ Comment blocks should be formatted as following: */ ``` +## Structs and Enums + +Structures and enums are formatted as following: + +```c +struct _FooBar +{ + guint32 field_one; + gchar *text; +}; + +typedef struct +{ + FooParent parent; + + guint32 field_one; + gchar *text; + + struct + { + CustomType *something; + guint something_else; + } inner_struct; + + gboolean flag : 1; +} FooBar; + +enum +{ + FIRST, + SECOND, + LAST, +}; + +typedef enum +{ + FOO_BAR_FIRST, + FOO_BAR_SECOND, + FOO_BAR_LAST, +} FooEnumBar; +``` + ## Header (.h) files It is organized by the following structure: