...
A loss of data (truncation) can occur when converting from a signed type to a signed type with less precision. The following code can result in truncationresults in a truncation error on most implementations::
Code Block | ||||
---|---|---|---|---|
| ||||
#include <limits.h> void func(void) { signed long int s_a = LONG_MAX; signed char sc = (signed char)s_a; /* Cast eliminates warning */ /* ... */ } |
...