I stumbled upon a question on Stack Overflow which concerns a specific, but common enough field of knowledge to have an own tag. It is this one:
How to solve the Misra Warning about applying bitwise operators ~ and << for underlying type
The field of knowledge here is the MISRA standard, which is unarguably somewhat specific, the standard isn't even open. However the question is properly tagged as such, has okay wording, and as it revealed to me looking the matter up in my copy of MISRA-2012 it is completely valid.
The poster couldn't really explain his problem any better in my opinion (he is asking it the first place since he doesn't understand why it happens), and it is sufficient for people having a knowledge of the standard. It is also a good question in my opinion as the related C behavior which the MISRA standard is guarding against is now very well understood (neither the way MISRA is guarding against it).
I would seriously like to flag those close votes in such cases, this attitude feels rather ignorant to me: If you don't understand a specific field, don't meddle with a related question. Is there a way to do this?
uint8_t
typed by the C standard, that's fine since it isn't. It's essential type by MISRA-C 2012 however is equivalent touint8_t
, and that was the whole point of the question, why it became a problem the first place. which should have been explained as an answer. It is not something which could be Googled, neither something apparent at a glance, it requires actually understanding MISRA fairly well. – Jubatian Jun 28 '18 at 10:53U
suffix havinguint8_t
, even under certain conditions (e.g. range). MISRA does not change the behaviour of the C compiler/(semantics of C code. That would be diametrically to it's purpose. – too honest for this site Jun 28 '18 at 10:58uint8_t
. It has nothing to do with the C standard, it is set by MISRA to guard against errors when porting between compilers with different int sizes. – Jubatian Jun 29 '18 at 4:16