-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathAV Rule 107.qhelp
More file actions
39 lines (28 loc) · 1000 Bytes
/
AV Rule 107.qhelp
File metadata and controls
39 lines (28 loc) · 1000 Bytes
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>
<p>
This rule finds functions that are declared in a block.
It is confusing to declare a function at block scope, and the visibility of the function is not what would be expected.
<code>extern</code> function declarations inside a block, which are allowed in C, are particularly confusing, as the scope
of the declaration is the entire file, not just the block where it was declared.
</p>
</overview>
<recommendation>
<p>
Declare the function in file scope to prevent any confusion as to its visibility.
</p>
</recommendation>
<example><sample src="AV Rule 107.cpp" />
</example>
<references>
<li>
AV Rule 107, <em>Joint Strike Fighter Air Vehicle C++ Coding Standards</em>. Lockheed Martin Corporation, 2005.
</li>
<li>
MISRA C++ Rule 3-1-2, <em>Guidelines for the use of the C++ language in critical systems</em>. The Motor Industry Software Reliability Associate, 2008.
</li>
</references>
</qhelp>