![]() |
O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
|
In C, there is two ways to include a header :
There is one technical difference : only the inclusion with "" searches for the header in the same directory as the current file (without the need to add a -I compiler flag or edit an environment variable).
So in the case of a private header, i.e. one in the src folder alongside the sources (as opposed to one in the include folder), there is a technical reason to use "" to include :
The rest of the time, either way of including could technically be used. So the following rule is an arbitrary convention :
When including a header, use "" if that header is in the same git repository, else use <>
So that means that when in o2s/string.h we are including o2s/array.h and stddef.h, we write:
While any inclusion order would do, going from most to least specific has an advantage: If someone were to write a header like o2s/array.h, using the type bool but forgetting to include stdbool.h, then as long as all source files that include o2s/array.h also include (directly or not) stdbool.h above, the omission would remain unnoticed.
So the convention here is something like :
Within a given group, lines are sorted alphabetically.