View mode: basic / threaded / horizontal-split · Log in · Help
August 13, 2004
Re: [dmd 0.98] little bug
Dawid Ciężarkiewicz schrieb:

> BTW. Why to keep varadic arguments in D? I'm just courious. Wouldn't be good
> to let it by used with "C" linkage only. IMHO banning it let compiler to
> use PASCAL like function returning with asm { "ret <number>" } which I read
> is more efficient. I'm not the expert, but I always thought that variadic
> arguments lays in C++ becouse of C compatiblity. Maybe D should leave it.

In fact, it's not really used in D - and those funcs in question are C 
library functions.

But why drop it? It's as crippled as in C. And we don't have a good 
replacement for it yet, such as powerful array literals. And there 
probably won't be any problem adding another varargs system later, as 
the time comes - they can coexist well.

In C, varargs affects performance, because the possible ambiguity 
requieres that all functions have the same calling convention, which 
happens to be a caller clean-up. C++ and D requiere that the functions 
be declared before use, thus there is no ambiguity and the compilers 
choose a calling convention depending on the function prototype - for 
varargs functions caller clean-up is used, otherwise the more efficient 
callee clean-up with possible register use.

On the other hand, would we loose anything by disallowing varargs in "D" 
convention right now?

Next ›   Last »
1 2
Top | Discussion index | About this forum | D home