README: Clarify how to name flag types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1765>
This commit is contained in:
parent
86435d88a2
commit
dcbd96df38
11
README.md
11
README.md
@ -63,7 +63,16 @@ with some additions:
|
|||||||
that may have side effects.
|
that may have side effects.
|
||||||
|
|
||||||
- Instead of boolean arguments in functions, prefer enums or flags when
|
- 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()`.
|
- Use `g_new0()` etc instead of `g_slice_new0()`.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user