[fpc-devel] va(r)_arg vs open array

Daniël Mantione daniel.mantione at freepascal.org
Mon Oct 2 15:15:55 CEST 2006



Op Mon, 2 Oct 2006, schreef ik:

> Hi,
> 
> I'm wondering why Pascal as a language (and FPC with it's extensions)
> does not support va_args (or var_args in the java language).

It does: array of const. If you declare a procedure cdecl it is even 
binary compatible with a C varargs.

> Now we have open array, that's a really cool thing, but I can't
> understand why I can't have a feature such as the compiler voodoo
> magic of the "write" procedure.

Syntactically you cannot. However, the array of const is just as powerfull 
(actually more powerfull, since you can pass multiple arrays). We consider 
adding a trick to make it syntactically behave like writeln unnecessary.

> At the moment, I try to create an OS (it's hard to even think of it as
> one at the moment, it will take a lot of time until it will be
> something close to an OS) with FPC, and when compiling the system unit
> again, I really missing it, and open arrays are just not "that" ...
> 
> I can give a list of pros about it, but I rather hear the pros and the
> cons from other first (maybe me and others will accept it) so what are
> the cons you see about it, and are there any pros that might be able
> to make it possible to add such feature to FPC ?

Show the problem with array if const first :)

Daniël


More information about the fpc-devel mailing list