1
0
Fork 0

doc/coding-style: Update guidelines for floating point numbers

The old guidelines aren't compatible with -Wfloat-conversion.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
This commit is contained in:
Jonas Ådahl 2024-06-18 12:17:13 +02:00 committed by Sebastian Wick
parent 422ee4515d
commit 0c014a23b4

View file

@ -50,7 +50,12 @@ style][gnome-coding-style], with some additions described below.
* Use `g_new0 ()` etc. instead of `g_slice_new0 ()`. * Use `g_new0 ()` etc. instead of `g_slice_new0 ()`.
* Initialize and assign floating point variables (i.e. `float` or * Initialize and assign floating point variables (i.e. `float` or
`double`) using the form `floating_point = 3.14159` or `ratio = 2.0`. `double`) using the the correct precision format, and don't omit zeros. For example
```c
float ratio = 2.0f;
double pi = 3.14159;
float fraction = 0.2f;
```
## Naming conventions ## Naming conventions