varargs

[next] [prev] [prev-tail] [tail] [up]

#### 14.9.26 varargs

This modifier can only be used together with the cdecl modifier, for external C procedures. It indicates that the procedure accepts a variable number of arguments after the last declared variable. These arguments are passed on without any type checking. It is equivalent to using the array of const construction for cdecl procedures, without having to declare the array of const. The square brackets around the variable arguments do not need to be used when this form of declaration is used.

The following declarations are two ways of referring to the same function in the C library:

Function PrintF1(fmt : pchar); cdecl; varargs;
external 'c' name 'printf';
Function PrintF2(fmt : pchar; Args : Array of const); cdecl;
external 'c' name 'printf';

But they must be called differently:

PrintF1('%d %d\n',1,1);
PrintF2('%d %d\n',[1,1]);

[next] [prev] [prev-tail] [front] [up]