CPP: Clearer naming.

This commit is contained in:
Geoffrey White
2019-01-18 16:04:39 +00:00
parent ca999473b0
commit bff23f546d
2 changed files with 7 additions and 7 deletions

View File

@@ -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. |

View File

@@ -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;
};