DConf talk : Exceptions will disappear in the future?

Jacob Carlborg doob at me.com
Thu Jan 7 10:36:39 UTC 2021


On 2021-01-07 01:01, sighoya wrote:

> Thanks, reminds on swift error types which are enum cases.

Swift can throw anything that implements the Error protocol. Classes, 
structs and enums can implement protocols.

> Oh, no please not. Interestingly we don't use longjmp in default 
> exception handling, but that would be a good alternative to Herb 
> Sutter’s proposal

Some platforms implement C++ exception using longjmp, for example, iOS.

> because exceptions are likewise faster, but have 
> likewise an impact on normal running code in case a new landing pad have 
> to be registered.
> But interestingly, the occurrence of this is much more seldom than 
> checking the return value after each function.

It's claimed that exceptions are not zero cost, even when an exception 
is not thrown. Because the compiler cannot optimize functions that may 
throw as well as those that cannot throw.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list