forked from github/codeql-coding-standards
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions1.cpp
More file actions
36 lines (28 loc) · 814 Bytes
/
functions1.cpp
File metadata and controls
36 lines (28 loc) · 814 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
void f1(int a); // COMPLIANT -- same name
void f2(int a); // COMPLIANT -- unnamed is fine
void f3(int a); // COMPLIANT -- diff number but for those that exist, same
void f4(int p, int b); // NON_COMPLIANT -- diff name
void f5(int b, int a); // NON_COMPLIANT -- swapped names
typedef int wi;
typedef int hi;
typedef long a;
a f6(wi w, wi h) { // NON_COMPLIANT
return (a)w * h;
}
void f7(int b, int a) { // NON_COMPLIANT
return;
}
void f8(int a) { // COMPLIANT
return;
}
template <class T> void f9(T t); // COMPLIANT
template <>
void f9<int>(int i); // COMPLIANT - specialization is a diff declaration
class ClassA {
virtual void methodA(int i); // NON_COMPLIANT
virtual void methodB(int i); // COMPLIANT
};
class ClassB : ClassA {
void methodA(int d) override;
void methodB(int i) override;
};