
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
53 lines
1.3 KiB
Plaintext
53 lines
1.3 KiB
Plaintext
== Why is this an issue?
|
||
|
||
If a program throws an unhandled exception it terminates in an implementation-defined manner. In particular, it is implementation-defined whether the call stack is unwound before termination, so the destructors of any automatic objects may or may not be executed. By enforcing the provision of a “last-ditch catch-all”, the developer can ensure that the program terminates in a consistent manner.
|
||
|
||
|
||
The possible exceptions from a program should be caught as a matter of course. This rule’s objective is to ensure that exceptions that were _not_ expected are also caught.
|
||
|
||
|
||
=== Compliant solution
|
||
|
||
For the majority of programs this will mean ``++main++`` should look like:
|
||
|
||
[source,cpp]
|
||
----
|
||
int32_t main( )
|
||
{
|
||
try
|
||
{
|
||
// program code
|
||
}
|
||
catch ( ... ) // Catch-all handler
|
||
{
|
||
// Handle unexpected exceptions
|
||
}
|
||
return 0;
|
||
}
|
||
----
|
||
|
||
|
||
== Resources
|
||
|
||
* MISRA {cpp}:2008, 15-3-2
|
||
* https://cwe.mitre.org/data/definitions/391[MITRE, CWE-391] - Unchecked Error Condition
|
||
|
||
ifdef::env-github,rspecator-view[]
|
||
|
||
'''
|
||
== Implementation Specification
|
||
(visible only on this page)
|
||
|
||
=== Message
|
||
|
||
Add a "catch ( ... )" handler to catch the possibly thrown exceptions.
|
||
|
||
|
||
'''
|
||
== Comments And Links
|
||
(visible only on this page)
|
||
|
||
include::../comments-and-links.adoc[]
|
||
|
||
endif::env-github,rspecator-view[]
|