26-09-2016, 11:18 AM
Ok, I just tested 2 different MISRA tools and both consider the following code to be compliant with 5-0-12:
As there seems to be a lot of interpretation going on among tool suppliers, i would suggest stripping down this rule to it´s bare essentials in the next version of MISRA C++:
Everything else in this rule is not a real problem IMHO.
In fact, in some communication protocols you have to mix numeric information (e.g. frame length) with character data (e.g. special strings).
How would you do that without deviating from 5-0-12 in it´s current form?
Code:
uint8_t str[] = {
static_cast('m'),
static_cast('i'),
static_cast('s'),
static_cast('r'),
static_cast('a')
};
As there seems to be a lot of interpretation going on among tool suppliers, i would suggest stripping down this rule to it´s bare essentials in the next version of MISRA C++:
Quote:Don't rely on the signedness of plain char. Period.
Code:
extern char x; if (x == -1)//non-compliant as it is implementation defined whether char is signed or unsigned
In fact, in some communication protocols you have to mix numeric information (e.g. frame length) with character data (e.g. special strings).
How would you do that without deviating from 5-0-12 in it´s current form?
<t></t>