Due to server problems the website is temporarily offline! Visit http://www.smorgasbordet.com/pellesc/ to download Pelles C.
#include <stdio.h>#include <stdlib.h>#include <limits.h>signed int main(void){ /* Two's complement */ signed char schar_min = 1; schar_min <<= ((sizeof(signed char) * CHAR_BIT) - 1); printf("%d\n", schar_min); return EXIT_SUCCESS;}
The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled withzeros. If E1 has an unsigned type, the value of the result is E1 × 2 E2 , reduced moduloone more than the maximum value representable in the result type. If E1 has a signedtype and nonnegative value, and E1 × 2 E2 is representable in the result type, then that isthe resulting value; otherwise, the behavior is undefined.
Pelles C warns on other occasions on undefined behaviour, such as shifting int outside it's width, as do other compilers like clang. Whether you want to ignore those warnings or not doesn't matter here.