http://d.puremagic.com/issues/show_bug.cgi?id=6857
--- Comment #63 from Walter Bright <bugzi...@digitalmars.com> 2012-05-07 08:29:21 PDT --- (In reply to comment #61) > (In reply to comment #58) > > It's not that simple. Several considerations have to be met: > > > > 1. Because of struct construction/destruction, you really only > > want to construct the parameter list *once*, but you're calling two > > functions with the same parameter list. > > Can't this be solved by simply making all struct parameters to the in/out > functions ref? Losing all C ABI compatiblity in the process. > I assume these were part of the reason for using nested functions to implement > contract inheritance. 2 is indeed something that needs to be considered. But > is forwarding the arguments any more difficult than putting the arguments onto > the stack in the first place? How do you forward a variadic function? You don't know what's on the stack to forward. > class A { > void foo_in(int n) { assert(n>0); } > int foo_dbc(int n) { foo_in(this, n); return foo(n); } > virtual int foo(int n) { return n; } > } > > then a call to foo would translate to a call to foo_dbc when compiling in > non-release mode. This also has the advantage of not changing the vtable > layout. Again, you're pushing the parameters on the stack twice - and this won't work for variadic functions. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------