Cppcoreguidelines: Add space after #include-statement

Created on 13 Oct 2016  路  4Comments  路  Source: isocpp/CppCoreGuidelines

I propose to add a space after #include statements in examples.

  • It's the industry convention on most if not every codebase I have come across:
  • It's the convention followed by Google (Chromium, Protobuf, ...), Apple (LLVM), Microsoft (Chakra)
  • SF.1 also uses "longstanding convention" as a argument. If applied to NL.15, there should be a space.
  • It is the convention in "The C++ programming language"
  • It is the convention in "The C Programming Language"
  • NL.17 says to use K&R style
  • SF.9 has a space after #include (albeit it's the only entry that uses quotes)
  • #include"foo.h" just looks weird
  • Using the NL.15 argument for omitting the space is inconsistent with NL.17 which tell you to put space after 'if'

Most helpful comment

I'm not sure about all of those arguments but the killer argument for me is:

  • #include"foo.h" just looks weird

馃榾

All 4 comments

I'm not sure about all of those arguments but the killer argument for me is:

  • #include"foo.h" just looks weird

馃榾

I fully agree. I faintly remember that there was already some discussion around this issue somewhere in the context of the NL.15 example, but I didn't realize this style has spread throughout the whole document.

Also important is the note in NL.15:

We value well-placed whitespace as a significant help for readability. Just don't overdo it.

BTTT Just wondering if this issue got overlooked?

Done, thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qalpaq picture qalpaq  路  5Comments

imre-palik picture imre-palik  路  6Comments

jeffreylindsey picture jeffreylindsey  路  5Comments

PeterSommerlad picture PeterSommerlad  路  5Comments

franzhollerer picture franzhollerer  路  6Comments