[fpc-pascal] Variable arguments, different types?
Vinzent Hoefler
JeLlyFish.software at gmx.net
Thu Mar 9 09:05:32 CET 2006
On Thursday 09 March 2006 04:31, L505 wrote:
> I have also read people stating things like this before:
>
> "you can use array of const but you can't make functions like writeln
> because writeln accepts multiple types".
Usually the statement is about different _numbers_ of arguments, not
different types. Writing subroutine which accept different types for
their arguments has never been a problem in Pascal.
> But in fact, with array of const, you can use multiple types.
You can, just as you can use different types in record types. Still, the
actual argument type would be the type of the record or, as in your
case "array of const" then. Don't confuse that.
And you still can't just pass two arguments when the subroutine expects
only one (yes, other trickery can be done with overloading and default
arguments).
Vinzent.
More information about the fpc-pascal
mailing list