September 29, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Attachments:
| I think the original intent behind D's c++ support was just to make it easier to work with c++. In other words your c++ come shouldn't throw exceptions to D anyway. So with golang you have to write a C wrapper. With D you can use c++. |
September 29, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brad Roberts | On 2012-09-29 03:20, Brad Roberts wrote: > And that's fine for your code, but if you want D and DMD to be a system > that people use for larger systems, then cutting down the sheer number of > things that don't work when pushed is kinda important. Exactly, I completely agree. -- /Jacob Carlborg |
September 29, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2012-09-29 03:01, Walter Bright wrote: > True, but I would never write code that tried to throw an exception > across language boundaries, anyway. It's just asking for trouble. If everything is working correctly and is compatible it shouldn't be any problems. -- /Jacob Carlborg |
September 29, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 9/29/12, Jacob Carlborg <doob@me.com> wrote:
> On 2012-09-29 03:01, Walter Bright wrote:
>
>> True, but I would never write code that tried to throw an exception across language boundaries, anyway. It's just asking for trouble.
>
> If everything is working correctly and is compatible it shouldn't be any problems.
Also how are we supposed to control when a C++ library throws? We could wrap every single function wrapper with a try/catch, but won't this create a massive slowdown?
What needs to be taken into account is that D will inevitably be able to link with many C++ libraries, some of which will have exceptions turned on. We now have SWIG with good but limited support of C++ wrapping, dstep will probably get C++ support, and my own (unreleased) dgen is a C++ wrapper generator too (it's starting to show signs of life, so far 2 C++ libraries were successfully automatically wrapped, pugixml and taglib).
|
September 29, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 2012-09-29 18:08, Andrej Mitrovic wrote: > Also how are we supposed to control when a C++ library throws? We > could wrap every single function wrapper with a try/catch, but won't > this create a massive slowdown? I'm not sure but I don't think so. As I understand it, DWARF on Posix and SEH on Windows are zero-cost exception handling systems. This means that there will be no performance loss at runtime as long as no exception is thrown. setjmp/longjmp on the other do have performance impacts at runtime. -- /Jacob Carlborg |
September 29, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 9/29/12, Jacob Carlborg <doob@me.com> wrote:
> I'm not sure but I don't think so. As I understand it, DWARF on Posix and SEH on Windows are zero-cost exception handling systems. This means that there will be no performance loss at runtime as long as no exception is thrown. setjmp/longjmp on the other do have performance impacts at runtime.
I see. Ok it's prime time for me to finally read the SEH chapter in Windows via C++. :)
|
September 29, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Saturday, 29 September 2012 at 19:21:59 UTC, Jacob Carlborg wrote:
> I'm not sure but I don't think so. As I understand it, DWARF on Posix and SEH on Windows are zero-cost exception handling systems.
Only the x64 variant of SEH is "zero-cost". On x86, exception handlers must be installed into a linked list in the function prologue, which takes a few pushes/movs and popped off again in the epilogue.
David
|
September 30, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 2012-09-29 23:26, David Nadlinger wrote: > Only the x64 variant of SEH is "zero-cost". On x86, exception handlers > must be installed into a linked list in the function prologue, which > takes a few pushes/movs and popped off again in the epilogue. > > David Ok, I see. -- /Jacob Carlborg |
October 01, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 9/29/2012 9:08 AM, Andrej Mitrovic wrote:
> What needs to be taken into account is that D will inevitably be able
> to link with many C++ libraries, some of which will have exceptions
> turned on. We now have SWIG with good but limited support of C++
> wrapping, dstep will probably get C++ support, and my own (unreleased)
> dgen is a C++ wrapper generator too (it's starting to show signs of
> life, so far 2 C++ libraries were successfully automatically wrapped,
> pugixml and taglib).
Also, consider that in C++ you can throw any type, such as an int. There is no credible way to make this work reasonably in D, as exceptions are all derived from Exception.
|
October 01, 2012 Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 10/1/12, Walter Bright <newshound1@digitalmars.com> wrote:
> Also, consider that in C++ you can throw any type, such as an int. There is no credible way to make this work reasonably in D, as exceptions are all derived from Exception.
Is that a bug or a feature? :)
|
Copyright © 1999-2021 by the D Language Foundation