-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathAV Rule 24.qhelp
More file actions
39 lines (28 loc) · 1.41 KB
/
AV Rule 24.qhelp
File metadata and controls
39 lines (28 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<!-- Mention that this rule may not be applicable in projects that don't follow the JSF standard. -->
<include src="../jsfNote.inc.qhelp" />
<p>
This query highlights calls to the standard library functions <code>abort, exit, getenv</code> and <code>system</code>.
The functions <code>abort</code> and <code>exit</code> should not be called as they immediately terminate the program
and will bypass all the normal error and exception handling routines in the software. This is especially important in
software which is run on systems without an interactive OS, as restarting the software may require a complete reboot
of the system. <code>getenv</code> and <code>system</code> will usually not work at all on systems that do not have a
command processor.
</p>
</overview>
<recommendation>
<p>
Do not use any of the functions mentioned above. Use the error/exception handling mechanism of the software system you are using
instead of <code>exit</code> or <code>abort</code>, or write your own functions to emulate the functionality provided
by running OS commands through <code>system</code> and <code>getenv</code>.
</p>
</recommendation>
<example><sample src="AV Rule 24.cpp" />
</example>
<references>
<li>AV Rule 24, <em>Joint Strike Fighter Air Vehicle C++ Coding Standards</em>. Lockheed Martin Corporation, 2005.
</li></references></qhelp>