Re: -betterC and extern(C++) classes

2017-09-10 Thread Walter Bright via Digitalmars-d
On 9/10/2017 8:08 AM, Yuxuan Shui wrote: By the way, can we dynamic_cast extern(C++) classes in C++? No. Generally, one would need C++ RTTI for that to work, and that: 1. is specific to the particular C++ compiler 2. is undocumented, half-documented, or wrongly documented 3. requires the C++

Re: -betterC and extern(C++) classes

2017-09-10 Thread Walter Bright via Digitalmars-d
On 9/10/2017 7:01 AM, Yuxuan Shui wrote: Is there a plan? Are there any simple tasks I can take/help? I filed an enhancement request: https://issues.dlang.org/show_bug.cgi?id=17822 The rest is kinda up to me.

Re: -betterC and extern(C++) classes

2017-09-10 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 10 September 2017 at 15:08:50 UTC, Yuxuan Shui wrote: By the way, can we dynamic_cast extern(C++) classes in C++? It doesn't work for me OOTB with dmd 2.075, at least (though I may be missing something): --- classes.d --- import core.memory; extern(C++) class Parent { char

Re: -betterC and extern(C++) classes

2017-09-10 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 10 September 2017 at 15:12:12 UTC, Yuxuan Shui wrote: On Sunday, 10 September 2017 at 14:42:42 UTC, Moritz Maxeiner wrote: On Sunday, 10 September 2017 at 14:04:20 UTC, rikki cattermole wrote: On 10/09/2017 2:19 PM, Moritz Maxeiner wrote: If TypeInfo for extern(C++) classes is

Re: -betterC and extern(C++) classes

2017-09-10 Thread Yuxuan Shui via Digitalmars-d
On Sunday, 10 September 2017 at 14:42:42 UTC, Moritz Maxeiner wrote: On Sunday, 10 September 2017 at 14:04:20 UTC, rikki cattermole wrote: On 10/09/2017 2:19 PM, Moritz Maxeiner wrote: If TypeInfo for extern(C++) classes is removed, couldn't final extern(C++) classes without base class and

Re: -betterC and extern(C++) classes

2017-09-10 Thread Yuxuan Shui via Digitalmars-d
By the way, can we dynamic_cast extern(C++) classes in C++? If not, what are we generating these TypeInfo_Class for?

Re: -betterC and extern(C++) classes

2017-09-10 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 10 September 2017 at 14:04:20 UTC, rikki cattermole wrote: On 10/09/2017 2:19 PM, Moritz Maxeiner wrote: If TypeInfo for extern(C++) classes is removed, couldn't final extern(C++) classes without base class and which don't implement any interfaces omit the vtable so that the

Re: -betterC and extern(C++) classes

2017-09-10 Thread rikki cattermole via Digitalmars-d
On 10/09/2017 2:19 PM, Moritz Maxeiner wrote: If TypeInfo for extern(C++) classes is removed, couldn't final extern(C++) classes without base class and which don't implement any interfaces omit the vtable so that the following assert holds: --- final extern(C++) class Foo {} static assert

Re: -betterC and extern(C++) classes

2017-09-10 Thread Yuxuan Shui via Digitalmars-d
On Sunday, 10 September 2017 at 09:31:55 UTC, Walter Bright wrote: On 9/10/2017 1:40 AM, Yuxuan Shui wrote: I was experimenting with -betterC and found out that C++ classes doesn't work. Because the resulting object file needs a symbol "_D14TypeInfo_Class6__vtblZ" which is in druntime. I

Re: -betterC and extern(C++) classes

2017-09-10 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 10 September 2017 at 09:31:55 UTC, Walter Bright wrote: On 9/10/2017 1:40 AM, Yuxuan Shui wrote: I was experimenting with -betterC and found out that C++ classes doesn't work. Because the resulting object file needs a symbol "_D14TypeInfo_Class6__vtblZ" which is in druntime. I

Re: -betterC and extern(C++) classes

2017-09-10 Thread Adam D. Ruppe via Digitalmars-d
On Sunday, 10 September 2017 at 09:31:55 UTC, Walter Bright wrote: Yes, we do want to move towards "Better C++" working in an analogous manner, and that means removing the typeinfo dependency. TypeInfo is cheap and useful with classes. You shouldn't be removing it, just stripping it to the

Re: -betterC and extern(C++) classes

2017-09-10 Thread Paulo Pinto via Digitalmars-d
On Sunday, 10 September 2017 at 08:56:11 UTC, rikki cattermole wrote: On 10/09/2017 9:40 AM, Yuxuan Shui wrote: I was experimenting with -betterC and found out that C++ classes doesn't work. Because the resulting object file needs a symbol "_D14TypeInfo_Class6__vtblZ" which is in druntime. I

Re: -betterC and extern(C++) classes

2017-09-10 Thread Walter Bright via Digitalmars-d
On 9/10/2017 1:40 AM, Yuxuan Shui wrote: I was experimenting with -betterC and found out that C++ classes doesn't work. Because the resulting object file needs a symbol "_D14TypeInfo_Class6__vtblZ" which is in druntime. I suppose this is to support T.classinfo? Could we remove T.classinfo and

Re: -betterC and extern(C++) classes

2017-09-10 Thread rikki cattermole via Digitalmars-d
On 10/09/2017 10:03 AM, 9il wrote: On Sunday, 10 September 2017 at 08:56:11 UTC, rikki cattermole wrote: On 10/09/2017 9:40 AM, Yuxuan Shui wrote: I was experimenting with -betterC and found out that C++ classes doesn't work. Because the resulting object file needs a symbol

Re: -betterC and extern(C++) classes

2017-09-10 Thread 9il via Digitalmars-d
On Sunday, 10 September 2017 at 08:56:11 UTC, rikki cattermole wrote: On 10/09/2017 9:40 AM, Yuxuan Shui wrote: I was experimenting with -betterC and found out that C++ classes doesn't work. Because the resulting object file needs a symbol "_D14TypeInfo_Class6__vtblZ" which is in druntime. I

Re: -betterC and extern(C++) classes

2017-09-10 Thread rikki cattermole via Digitalmars-d
On 10/09/2017 9:40 AM, Yuxuan Shui wrote: I was experimenting with -betterC and found out that C++ classes doesn't work. Because the resulting object file needs a symbol "_D14TypeInfo_Class6__vtblZ" which is in druntime. I suppose this is to support T.classinfo? Nope. Could we remove

-betterC and extern(C++) classes

2017-09-10 Thread Yuxuan Shui via Digitalmars-d
I was experimenting with -betterC and found out that C++ classes doesn't work. Because the resulting object file needs a symbol "_D14TypeInfo_Class6__vtblZ" which is in druntime. I suppose this is to support T.classinfo? Could we remove T.classinfo and make classes work under -betterC? Or is