| September 22, 1999 | Strong Typing | Slide #10 |
int main(void)
{
unsigned char *c;
float f = 10;
for (c = (char *)&f; c < sizeof(float) + (char *)&f; c++) {
printf("%u ", *c);
}
putchar('\n');
return 0;
}
float.c: In function `main':
float.c:10: warning: comparison of distinct pointer types
lacks a cast
Warning is spurious
Worse version of the same problem on the same line is ignored
Whole program is one giant type violation, but compiler doesn't care
| Next | ![]() |
Copyright © 1999 M-J. Dominus |