In a example below, I want to know the call of func
with a wrong type of argument - vptr
, which should be called with an int
pointer.
void func(int * ptr){
}
int main(){
void * vptr;
func(vptr);
}
GCC doesn't warn this type of warnings even with wall option. Is there any other options in gcc, or other programming tricks of finding out those bad manners of codes. Aside that, how about in cpp?
EDIT:
VTT answered this is valid in C, but invalid in C++ with no other cast keywords like static_cast
(see the other post in detail).