mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
style issues
This commit is contained in:
parent
0aea7d997b
commit
27b585ad71
|
@ -3142,10 +3142,10 @@ Here on one popular implementation I got the output:
|
|||
|
||||
I expected that because the call of `g()` reuses the stack space abandoned by the call of `f()` so `*p` refers to the space now occupied by `gx`.
|
||||
|
||||
Imagine what would happen if `fx` and `gx` were of different types.
|
||||
Imagine what would happen if `fx` or `gx` was a type with an invariant.
|
||||
Imagine what would happen if more that dangling pointer was passed around among a larger set of functions.
|
||||
Imagine what a cracker could do with that dangling pointer.
|
||||
* Imagine what would happen if `fx` and `gx` were of different types.
|
||||
* Imagine what would happen if `fx` or `gx` was a type with an invariant.
|
||||
* Imagine what would happen if more that dangling pointer was passed around among a larger set of functions.
|
||||
* Imagine what a cracker could do with that dangling pointer.
|
||||
|
||||
Fortunately, most (all?) modern compilers catch and warn against this simple case.
|
||||
|
||||
|
@ -12069,7 +12069,7 @@ A `thread` that has not been `detach()`ed when it is destroyed terminates the pr
|
|||
|
||||
##### Enforcement
|
||||
|
||||
* Flag `join's for `raii_thread`s ???
|
||||
* Flag `join`s for `raii_thread`s ???
|
||||
* Flag `detach`s for `detached_thread`s
|
||||
|
||||
|
||||
|
@ -15762,7 +15762,7 @@ Use `!=` instead of `<` to compare iterators; `!=` works for more objects becaus
|
|||
// ...
|
||||
}
|
||||
|
||||
Of course, range-for is better still where it does what you want.
|
||||
Of course, range-`for` is better still where it does what you want.
|
||||
|
||||
##### Example
|
||||
|
||||
|
@ -16409,7 +16409,7 @@ This slowdown can be significant compared to `printf`-style output.
|
|||
##### Example
|
||||
|
||||
cout << "Hello, World!" << endl; // two output operations and a flush
|
||||
cout << "hello, World!\n"; // one output operation and no flush
|
||||
cout << "Hello, World!\n"; // one output operation and no flush
|
||||
|
||||
##### Note
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user