casey@gauss.llnl.gov (Casey Leedom) (12/02/89)
I don't get a chance to program much these days which is why I haven't noticed this before. I was pointing out to someone that one of the advantages of ANSI C and hence GNU GCC was function parameter type checking. In the process of trying to demonstrate it I was unable to ever get GNU GCC to issue a parameter type mismatch. I also couldn't get GNU GCC to automatically coerce passed parameters to functions' parameter types as I thought the ANSI C specification specified and ANSI C compiler would do. (I may be totally off base on that last issue.) If GNU GCC won't issue type mismatch messages for function parameter type mismatches, what's the point of function proto-typing? I used the following with every combination of -ansi, -pedantic, -Wfoo that I could think of to try to get GNU GCC to generate some kind of warning message: main() { sub("test"); } sub(float a) { } Am I just doing something wrong/stupid? Or is this a feature that isn't supported yet? Will it ever be? Casey
casey@gauss.llnl.gov (Casey Leedom) (12/02/89)
Thanks to everyone for pointing out my mistake. It's just been too long since I last did any real programming. I should have seen the problem myself. I needed to declare the function "sub" in some manner before using it to get ANSI parameter type checking. I could have done this either by placing the text of "sub" before "main" or by offering a prototype declaration of "sub" before using it in "main".