Why don't I get a warning when passing a parameter to a function that should not accept an incoming parameter?

I have a function like:

//in header
int Foo()
// in source file
int Foo()
{
    return 1;
}

In one of the other source files, I refer to the function as:

int aninteger;
result = Foo(aninteger);

This code compiles without warning. Any idea why? How to set up visual studio to warn about inconsistencies of arguments during function calls?

+4
source share
1 answer

, , , , , . , .

int Foo(void), .

gcc -Wstrict-prototypes, , , .

+12

Source: https://habr.com/ru/post/1654140/


All Articles