-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA0-1-3.cpp
More file actions
73 lines (48 loc) · 914 Bytes
/
A0-1-3.cpp
File metadata and controls
73 lines (48 loc) · 914 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Rule: A0-1-3
// Source line: 1707
// Original file: A0-1-3.cpp
//% $Id: A0-1-3.cpp 291350 2017-10-17 14:31:34Z jan.babst $
#include <cstdint>
static void F1() // Compliant
{}
namespace
{
void F2() // Non-compliant, defined function never used
{}
}
class C
{
public:
C() : x(0) {}
void M1(std::int32_t i) // Compliant, member function is used
{
x = i;
}
void M2(std::int32_t i, std::int32_t j)
// Compliant, never used but declared
// as public
{
x = (i > j) ? i : j;
}
protected:
void M1ProtectedImpl(std::int32_t j)
{
x = j;
// Compliant, never used but declared
// as protected
}
private:
std::int32_t x;
void M1PrivateImpl( // Non-compliant, private member function never used
std::int32_t j)
{
x = j;
}
};
int main(int, char**)
{
F1();
C c;
c.M1(1);
return 0;
}