CPP: Fix type logic.

This commit is contained in:
Geoffrey White
2018-12-13 09:48:34 +00:00
parent c904a338f7
commit e443eb8889
3 changed files with 4 additions and 5 deletions

View File

@@ -4,5 +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:88:35:88:47 | sizeof(MyABC) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is myChar *const. |
| test.cpp:89:40:89:52 | sizeof(MyABC) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is myInt *const. |

View File

@@ -85,7 +85,7 @@ public:
pairPtr((myChar *)malloc(sizeof(MyABC) * 2)),
pairPtrInt((myInt *)malloc(sizeof(MyABC) * 2))
{
myChar *secondPtr = pairPtr + sizeof(MyABC); // GOOD [FALSE POSITIVE]
myChar *secondPtr = pairPtr + sizeof(MyABC); // GOOD
myInt *secondPtrInt = pairPtrInt + sizeof(MyABC); // BAD
}