extern(C++) with template produces wrong mangleof

2016-12-02 Thread Timothee Cour via Digitalmars-d-learn
What's the difference bw _Z21test_D20161202T141925IiET_S0_ and _Z21test_D20161202T141925IiEii? mangleof produces the one that's not in the library produced: test.cpp: ``` template T test_D20161202T141925(T a); template int test_D20161202T141925(int); ``` clang++ -shared -o libtest.so test.cpp

Re: Delegates: Print 0..9

2016-12-02 Thread Timon Gehr via Digitalmars-d-learn
On 01.12.2016 21:12, Ali Çehreli wrote: This is a common issue with D and some other languages (as I had learned during a Dart language presentation, of which Dart does not suffer from). All those delegates do close on the same loop variable. You need to produce copies of the variable. This

Re: the best language I have ever met(?)

2016-12-02 Thread Igor Shirkalin via Digitalmars-d-learn
On Monday, 28 November 2016 at 16:15:23 UTC, Jonathan M Davis wrote: That's what pragma(inline, true) is for. And if someone wants a different solution that's completely compile-time and doesn't work with variables, then fine. I'm talking about adding something to the standard library, and for

Re: how to catch D Throwables (or exceptions) from C++?

2016-12-02 Thread Elie Morisse via Digitalmars-d-learn
On Friday, 2 December 2016 at 08:13:51 UTC, Jacob Carlborg wrote: On 2016-12-01 02:58, Timothee Cour via Digitalmars-d-learn wrote: eg: ``` dlib.d: extern(C) void dfun(){assert(0, "some_msg");} clib.cpp: extern "C" void dfun(); void fun(){ try{ dfun(); } catch(...){ // works but

Re: how to catch D Throwables (or exceptions) from C++?

2016-12-02 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-12-01 02:58, Timothee Cour via Digitalmars-d-learn wrote: eg: ``` dlib.d: extern(C) void dfun(){assert(0, "some_msg");} clib.cpp: extern "C" void dfun(); void fun(){ try{ dfun(); } catch(...){ // works but how do i get "some_msg" thrown from D? } } ``` At least for a