I am using PCLint v 9.00h
In my code I have the following (where S16 is a signed 16 bit):
S16 temperatureResult = -32768;
Which unless
It comes to mind to try:
S16 temperatureResult = (S16) 0x8000; // ASSUMES twos complement integers
The explicit cast is because Rule 10.1 says
"The value of an expression of integer type shall not be implicitly converted to a different underlying type if ..."
Make it portable:
S16 temperatureResult = -32767 - 1;
But anyway, if MISRA requires compatibility with ones complement computers (like some Cray supercomputers), then the guaranteed range of signed 16-bit is only [-32767 ... 32767] so you can't achieve what you're trying to do.