mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
CPP: Clearer naming.
This commit is contained in:
@@ -4,4 +4,4 @@
|
||||
| test.cpp:30:25:30:35 | sizeof(int) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is int *. |
|
||||
| test.cpp:38:30:38:40 | sizeof(int) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is int *. |
|
||||
| test.cpp:61:27:61:37 | sizeof(int) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is int *. |
|
||||
| test.cpp:89:40:89:52 | sizeof(MyABC) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is myInt *const. |
|
||||
| test.cpp:89:43:89:55 | sizeof(MyABC) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is myInt *const. |
|
||||
|
||||
@@ -82,14 +82,14 @@ class MyTest8Class
|
||||
{
|
||||
public:
|
||||
MyTest8Class() :
|
||||
pairPtr((myChar *)malloc(sizeof(MyABC) * 2)),
|
||||
pairPtrInt((myInt *)malloc(sizeof(MyABC) * 2))
|
||||
myCharsPointer((myChar *)malloc(sizeof(MyABC) * 2)),
|
||||
myIntsPointer((myInt *)malloc(sizeof(MyABC) * 2))
|
||||
{
|
||||
myChar *secondPtr = pairPtr + sizeof(MyABC); // GOOD
|
||||
myInt *secondPtrInt = pairPtrInt + sizeof(MyABC); // BAD
|
||||
myChar *secondPtr = myCharsPointer + sizeof(MyABC); // GOOD
|
||||
myInt *secondPtrInt = myIntsPointer + sizeof(MyABC); // BAD
|
||||
}
|
||||
|
||||
private:
|
||||
myChar * const pairPtr;
|
||||
myInt * const pairPtrInt;
|
||||
myChar * const myCharsPointer;
|
||||
myInt * const myIntsPointer;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user