http://d.puremagic.com/issues/show_bug.cgi?id=8545
art.08...@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |art.08...@gmail.com --- Comment #4 from art.08...@gmail.com 2012-08-14 03:21:53 PDT --- (In reply to comment #3) > (In reply to comment #2) > > I don't think this is major, because you can use a union: > > > > { > > static union U { Object o; void* p; } > > U u; > > u.o = this; > > return u.p; > > } > > > > In fact, because a union can be used for reinterpret casting, I don't think > > any > > new syntax or semantics are needed. > > I'm speaking in terms of wrapping C++ libraries (A C++ wrapper class has an > inner d_object pointer which it uses to invoke D virtual methods). You're > asking me to introduce overhead for every time a new class object is > instantiated. The compiler /should/ handle it w/o any additional runtime overhead. You could also use void* test() { return *cast(void**)&this; } Which approach will be more efficient probably depends on compiler implementation; ideally both versions should be free. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------