As others mention, this is an early style coding function.
The following is a trap of this style. Remember that checking passed parameters does not exist. . This may explain your run-time differences.
Say you declare a function
int foo(a,b,c);
All at this point the compiler sees a function called "foo" that takes 3 arguments and returns an int . Thus, usage verification is limited to this.
Suppose that sizeof(short) < sizeof(int) < sizeof(long) and the function is defined as
int foo(a,b,c) int a; long b; int c; { }
Note the following use of foo
int d,e,f; d = foo(1,2L,3); e = foo((short)1,2L,3); f = foo(1,2,3);
The first customs work fine, the correct integer values ββare passed to foo .
2nd customs also work great. The first argument, up to the size of int before calling, like printf("%d", (short)2) , advances (short)2 to int before going to printf() .
The third problem, because the compiler does not know that the second argument must be long . Thus, the data passed to foo is not transferred correctly. β UB
source share