I was debugging my program and I accidentally pointed an int as a parameter for a pointer object. Am I wrong in thinking doing this should issue a warning by the compiler?
I was debugging my program and I accidentally pointed an int as a parameter for a pointer object. Am I wrong in thinking doing this should issue a warning by the compiler?
Let me see now... where did I put that crystal ball?
Ahhh... there it is... Just give it a little shining up...
Focus in on vexed .... sorry: "Error, signal too weak for clear image"....
Care to try again, maybe post the problem code this time?
<< !! Posting Code? Read this First !! >>
I meant in the general case. For instance:
If given a methodA, declared here:
methodA(Pointer* p, int a) {
}
And a methodB that calls methodA:
methodB() {
methodA(blah1, &blah2);
}
where blah1 and blah2 are both ints, should compiling this code produce a warning? I know that C isn't as strict on type checking but I find weird (as a new C programmer) that in my case it didn't.
It should result in a warning. If it does not, you probably failed to provide a declaration (that is either a prototype or a definition) for methodA before the definition of methodB.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Post your code in code tag.
It's well not method, but function.
What compiler are you using?
Read your compiler documentation, how to enable warning(level) etc.
Thanks for the responses! After thinking about prototype/definition, I looked into my header file and realized that the prototype for function methodA was incorrectly written as described in methodB.
Dang, that is embarrassing. Guess my noob sign definitely rang out haha (calling them methods rather than functions).