From dcbd96df38f69b10e6ad9eb213c89f5193240381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 9 Mar 2021 20:40:39 +0100 Subject: [PATCH] README: Clarify how to name flag types Part-of: --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cedaf25b4..d57296a7c 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,16 @@ with some additions: that may have side effects. - Instead of boolean arguments in functions, prefer enums or flags when - they're more expressive. + they're more expressive. The naming convention for flags is + +```c +typedef _MetaSomeThingFlags +{ + META_SOME_THING_FLAG_NONE = 0, + META_SOME_THING_FLAG_ALTER_REALITY = 1 << 0, + META_SOME_THING_FLAG_MANIPULATE_PERCEPTION = 1 << 1, +} MetaSomeThingFlags; +``` - Use `g_new0()` etc instead of `g_slice_new0()`.