mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
fixed markdown style errors
This commit is contained in:
committed by
Thibault Kruse
parent
757737e86d
commit
122ce83509
@@ -6815,6 +6815,7 @@ Union rule summary:
|
|||||||
|
|
||||||
##### Example
|
##### Example
|
||||||
|
|
||||||
|
|
||||||
???
|
???
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
@@ -6825,6 +6826,7 @@ Union rule summary:
|
|||||||
|
|
||||||
##### Reason
|
##### Reason
|
||||||
|
|
||||||
|
|
||||||
Naked unions are a source of type errors.
|
Naked unions are a source of type errors.
|
||||||
|
|
||||||
**Alternative**: Wrap them in a class together with a type field.
|
**Alternative**: Wrap them in a class together with a type field.
|
||||||
@@ -6835,6 +6837,8 @@ Naked unions are a source of type errors.
|
|||||||
|
|
||||||
???
|
???
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|
||||||
???
|
???
|
||||||
@@ -10322,7 +10326,7 @@ Not all data races are as easy to spot as this one.
|
|||||||
}
|
}
|
||||||
|
|
||||||
Now, a compiler that does not know that `val` can change will most likely implement that `switch` using a jump table with five entries.
|
Now, a compiler that does not know that `val` can change will most likely implement that `switch` using a jump table with five entries.
|
||||||
Then, a `val` outside the [0..4] range will cause a jump to an address that could be anywhere in the program, and execution would proceed there.
|
Then, a `val` outside the `[0..4]` range will cause a jump to an address that could be anywhere in the program, and execution would proceed there.
|
||||||
Really, "all bets are off" if you get a data race.
|
Really, "all bets are off" if you get a data race.
|
||||||
Actually, it can be worse still: by looking at the generated code you may be able to determine where the stray jump will go for a given value;
|
Actually, it can be worse still: by looking at the generated code you may be able to determine where the stray jump will go for a given value;
|
||||||
this can be a security risk.
|
this can be a security risk.
|
||||||
@@ -10791,7 +10795,7 @@ A `thread` that has not been `detach()`ed when it is destroyed terminates the pr
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::thread t1{f}; // f() executes in separate thread
|
std::thread t1{f}; // f() executes in separate thread
|
||||||
std::thread t2{F()}; // F()() executes in separate thread
|
std::thread t2{F()}; // F()() executes in separate thread
|
||||||
} // spot the bugs
|
} // spot the bugs
|
||||||
|
|
||||||
@@ -10805,7 +10809,7 @@ A `thread` that has not been `detach()`ed when it is destroyed terminates the pr
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::thread t1{f}; // f() executes in separate thread
|
std::thread t1{f}; // f() executes in separate thread
|
||||||
std::thread t2{F()}; // F()() executes in separate thread
|
std::thread t2{F()}; // F()() executes in separate thread
|
||||||
|
|
||||||
t1.join();
|
t1.join();
|
||||||
|
|||||||
Reference in New Issue
Block a user