2-13-3: False positives on multi-dimensional arrays
Closed this issue · 0 comments
rettichschnidi commented
The checker can not deal with multi-dimensional arrays:
int array3D[2][3][4];
static_assert( 2U == sizeof(array3D)/sizeof(array3D[0]), "");
static_assert( 3U == sizeof(array3D[0])/sizeof(array3D[0][0]), "");
static_assert( 4U == sizeof(array3D[0][0])/sizeof(array3D[0][0][0]), "");
Resulting errors:
test/2-13-3.cpp:41:56: error: A "U " suffix shall be applied to all octal or hexadecimal integer literals of unsigned type. (MISRA C++ 2008 rule 2-13-3)
static_assert( 3U == sizeof(array2D[0])/sizeof(array2D[0][0]), "");
^
test/2-13-3.cpp:42:37: error: A "U " suffix shall be applied to all octal or hexadecimal integer literals of unsigned type. (MISRA C++ 2008 rule 2-13-3)
static_assert( 4U == sizeof(array2D[0][0])/sizeof(array2D[0][0][0]), "");
^
test/2-13-3.cpp:42:59: error: A "U " suffix shall be applied to all octal or hexadecimal integer literals of unsigned type. (MISRA C++ 2008 rule 2-13-3)
static_assert( 4U == sizeof(array2D[0][0])/sizeof(array2D[0][0][0]), "");
^
test/2-13-3.cpp:42:62: error: A "U " suffix shall be applied to all octal or hexadecimal integer literals of unsigned type. (MISRA C++ 2008 rule 2-13-3)
static_assert( 4U == sizeof(array2D[0][0])/sizeof(array2D[0][0][0]), "");