[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CODAN question for function can not be resolved AND invalid arguments!

2010/9/10 Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx>
If you really think it is invalid create this program: two files (No headers).

ÂÂ foo(int a) {

ÂÂÂÂ foo("bla");


In this case, in translation unit main.c, function 'foo' is undefined. Thus it's assumed it's int foo() (abitrary number of params), so it will compile and link. The same if you change call to foo("bla","bla").

Change main.c to:

int foo(int);
main() {
ÂÂ foo("bla","bla");

and it won't compile because of parameter mismatch - this is the case we're discussing. C++ parser gives a problem binding here, C parser doesn't = inconsistency.