mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
adding space after includes per #769
This commit is contained in:
parent
49abfa6509
commit
f9f35c78bc
|
@ -1,6 +1,6 @@
|
|||
# <a name="main"></a>C++ Core Guidelines
|
||||
|
||||
March 20, 2017
|
||||
March 27, 2017
|
||||
|
||||
|
||||
Editors:
|
||||
|
@ -8694,14 +8694,14 @@ Any type (including primary template or specialization) that overloads unary `*`
|
|||
##### Example
|
||||
|
||||
// use Boost's intrusive_ptr
|
||||
#include<boost/intrusive_ptr.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
void f(boost::intrusive_ptr<widget> p) // error under rule 'sharedptrparam'
|
||||
{
|
||||
p->foo();
|
||||
}
|
||||
|
||||
// use Microsoft's CComPtr
|
||||
#include<atlbase.h>
|
||||
#include <atlbase.h>
|
||||
void f(CComPtr<widget> p) // error under rule 'sharedptrparam'
|
||||
{
|
||||
p->foo();
|
||||
|
@ -10049,7 +10049,7 @@ Requires messy cast-and-macro-laden code to get working right.
|
|||
|
||||
##### Example
|
||||
|
||||
#include<cstdarg>
|
||||
#include <cstdarg>
|
||||
|
||||
// "severity" followed by a zero-terminated list of char*s; write the C-style strings to cerr
|
||||
void error(int severity ...)
|
||||
|
@ -10089,7 +10089,7 @@ This is basically the way `printf` is implemented.
|
|||
##### Enforcement
|
||||
|
||||
* Flag definitions of C-style variadic functions.
|
||||
* Flag `#include<cstdarg>` and `#include<stdarg.h>`
|
||||
* Flag `#include <cstdarg>` and `#include<stdarg.h>`
|
||||
|
||||
## ES.stmt: Statements
|
||||
|
||||
|
@ -16414,7 +16414,7 @@ Your IDE (if you use one) may have strong opinions about suffices.
|
|||
int a; // a definition
|
||||
void foo() { ++a; }
|
||||
|
||||
`#include<foo.h>` twice in a program and you get a linker error for two one-definition-rule violations.
|
||||
`#include <foo.h>` twice in a program and you get a linker error for two one-definition-rule violations.
|
||||
|
||||
##### Enforcement
|
||||
|
||||
|
@ -16436,11 +16436,11 @@ Including entities subject to the one-definition rule leads to linkage errors.
|
|||
}
|
||||
|
||||
// file1.cpp:
|
||||
#include<file.h>
|
||||
#include <file.h>
|
||||
// ... more ...
|
||||
|
||||
// file2.cpp:
|
||||
#include<file.h>
|
||||
#include <file.h>
|
||||
// ... more ...
|
||||
|
||||
Linking `file1.cpp` and `file2.cpp` will give two linker errors.
|
||||
|
@ -16492,20 +16492,20 @@ Minimize context dependencies and increase readability.
|
|||
|
||||
##### Example
|
||||
|
||||
#include<vector>
|
||||
#include<algorithm>
|
||||
#include<string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
// ... my code here ...
|
||||
|
||||
##### Example, bad
|
||||
|
||||
#include<vector>
|
||||
#include <vector>
|
||||
|
||||
// ... my code here ...
|
||||
|
||||
#include<algorithm>
|
||||
#include<string>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
##### Note
|
||||
|
||||
|
@ -16555,7 +16555,7 @@ The errors will not be caught until link time for a program calling `bar` or `fo
|
|||
int foobar(int);
|
||||
|
||||
// foo.cpp:
|
||||
#include<foo.h>
|
||||
#include <foo.h>
|
||||
|
||||
void foo(int) { /* ... */ }
|
||||
int bar(double) { /* ... */ }
|
||||
|
@ -18392,7 +18392,7 @@ Too much space makes the text larger and distracts.
|
|||
|
||||
##### Example
|
||||
|
||||
#include<map>
|
||||
#include <map>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user