[Issue 1839] Give D a modern varargs system that allows forwarding

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 15 02:16:20 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1839





------- Comment #9 from aarti at interia.pl  2008-02-15 04:16 -------
Isn't it that variable arguments templates have its own problems also? 

Executable size will increase very quickly for different types/combinations of
parameters. AFAIK it will happen especially when template body will be very
big. Sure you can split big template into smaller, but it means also that size
of program will heavily depend on coding style of programmer. Or is it possible
to optimize such a big template automagically?

But I think that, if variable argument templates are not able to be instant
replacement (considering e.g. size of executable), variable arguments functions
should stay...

When they would stay a few simple fixes would probably enhance current
situation in order of magnitude.

1. Defining struct, which will keep typeinfo pointer and data pointer
   e.g. struct Arg {TypeInfo type; void* ptr;}
2. Then variable argument functions could be declared like other type safe
variadic argument functions in D:
void func(Arg[] param...) {}

...and the problem with passing arguments would be solved... (also ugly local
variables (=hacks): _argptr, _arguments could disappear).


-- 



More information about the Digitalmars-d-bugs mailing list