Skip to content

Commit a453902

Browse files
committed
docs: Reword paragpraph about include sorting a little
1 parent 5a0c99a commit a453902

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

docs/CODING_STYLE.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,16 @@ SPDX-License-Identifier: LGPL-2.1-or-later
344344
}
345345
```
346346
347-
- The order in which header files are included doesn't matter too
348-
much. systemd-internal headers must not rely on an include order, so it is
349-
safe to include them in any order possible. However, to not clutter global
350-
includes, and to make sure internal definitions will not affect global
351-
headers, please always include the headers of external components first
352-
(these are all headers enclosed in <>), followed by our own exported headers
353-
(usually everything that's prefixed by `sd-`), and then followed by internal
354-
headers. Furthermore, in all three groups, order all includes alphabetically
355-
so duplicate includes can easily be detected.
347+
- systemd-internal headers must not rely on an include order, so that it is safe
348+
to include them in any order possible. To not clutter global includes, and to
349+
make sure internal definitions will not affect global headers, please always
350+
include the headers of external components first (these are all headers
351+
enclosed in <>), followed by our own exported headers (usually everything
352+
that's prefixed by `sd-`), and then followed by internal headers. Furthermore,
353+
in all three groups, all includes should be ordered alphabetically. Note that
354+
sometimes, we do not sort system headers alphabetically when they rely on
355+
being included in a specific order. For example `<netinet/in.h>` has to be
356+
included before `<linux/in.h>`.
356357
357358
- Please avoid using global variables as much as you can. And if you do use
358359
them make sure they are static at least, instead of exported. Especially in

0 commit comments

Comments
 (0)