On 2019-06-21 15:33:24 +0200, Christian Jullien wrote: > If I read you correctly, you want to protest if type does not > strictly match format directive. > > This is something even gcc does NOT ensure by default: [...]
This is undefined behavior, and the compiler is not required to complain. This can just mean that your code will silently be compiled in an unexpected way. [...] > int i = 256; > > const char* s = "Hello"; > > const void* p = s; > > > > printf("%x\n", i); > > printf("%u %s\n", i, p); [...] > Only -Wformat (or -Wall) shows a warning on the 2nd printf, printf > of i (a signed) is always Ok. I don't think this is correct for i as int and unsigned int are not compatible types... even though 256 has the same representation as int and unsigned int (I think that the C standard should have been more flexible in such a case). -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel