Confusion over function call in pre-ANSI C syntax

I am dealing with some pre-ANSI C syntax. See I have the following function call in one conditional

 BPNN *net;
 // Some more code
 double val;
 // Some more code, and then,
 if (evaluate_performance(net, &val, 0)) {

But then the function evaluate_performancewas defined as follows (below a function that has the aforementioned conditional value):

evaluate_performance(net, err)
BPNN *net;
double *err;
{

How did it happen that it evaluate_performancewas set with two parameters, but called with three arguments? What does "0" mean?

And by the way, I'm pretty sure that he does not call any other evaluate_performance, defined elsewhere; I grepedited all the files, and I'm sure that we should talk about the same thing evaluate_performancehere.

Thank!

+5
source share
4 answers

, ( ), , int. , char short int s, float - double ( ).

โ€‹โ€‹ C-, - int, , , .

C99, C, , - C99 .

, undefined C89. .

+7

, , . ( C99 .)

, . , int , ( , int unsigned int, float double). (C99 , C99.)

, ( ).

, undefined. , ; .

, , ; .

ANSI .

? ?

+3

C , . :

int foo()
{
   printf("here");
}

int main()
{
   foo(3,4);
   return 0;
}

, , "here". . , .

+2

C, .

, , !

/ undefined. , , . , , , , ( , , , "undefined"...)

Note that this can be done (add additional parameters) when using ellipsis, as in printf ():

printf(const char *format, ...);

I would suggest that the function had 3 parameters at some point, and the latter was deleted because it was not used, and some parts of the code were not fixed, as it should be. I would delete this third parameter, just in case the stack goes in the wrong order and thus cannot send the correct parameters to the function.

+1
source

All Articles