Pete's Log: silly weak typing

Entry #1049, (Coding, Hacking, & CS stuff)
(posted when I was 22 years old.)

This is interesting... the following bit of C code compiles without any warnings, as best as I can tell. I've compiled it using KCC and gcc -Wall.

int main()
{
  void *p;

  p = (struct foobar*) 0;

  return (int) p;
}


I suppose it kind of makes sense that it would compile, seeing how a pointer is a pointer is a pointer, but the lack of warning is silly, in my humblest of opinions. I was messing around within mona, and found several spots where a variable was being cast to a (struct mona_k2u*) but was having a difficult time figuring out what this mona_k2u struct actually was, until I discovered that it actually wasn't defined anywhere. Silly mona.