Why doesn't GCC produce a warning when assigning a signed literal to an unsigned type?
- by maerics
Several questions on this website reveal pitfalls when mixing signed and unsigned types and most compilers seem to do a good job about generating warnings of this type. However, GCC doesn't seem to care when assigning a signed constant to an unsigned type! Consider the following program:
/* foo.c */
#include <stdio.h>
int main(void)
{
…