Skip to main content

[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.c:
   foo(int a) {
  }

main.c:
  main(){
     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.

Back to the top