google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37.01k stars 13.28k forks source link

unclear include order in C headers #771

Open nnrepos opened 1 year ago

nnrepos commented 1 year ago

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:

// bye.h copyright: me.

#include <unistd.h>
#include <../hello.h>
#include <map>

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 :)