google / google/styleguide

unclear include order in C headers

Open
#771 2 comments 0 reactions 0 assignees View on GitHub
lang:cpp
Dominant language
HTML
Stars
39.6k
Forks
12.9k
Avg merge
42m
Merged PRs (30d)
15

Description

> C system headers (more precisely: headers in angle brackets with the .h extension), e.g., , .
the clarification actually makes things worse - any file can be included via angle brackets, all they do is tell the compiler to search in some predefined path, rather than the local directory.

if i have the following files:

```
root/
hello.h
nice/
bye.h
```

then, within `root/nice/bye.h`, the order of the following lines is not clear:
```cpp
// bye.h copyright: me.

#include
#include <../hello.h>
#include
```

on one hand, `hello.h` is within angle brackets. on the other hand, it's another library's / my project's `.h` file.

please help :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.