What is the point of nothrow?

Kagamin spam at here.lot
Fri Jun 15 08:13:44 UTC 2018


On Wednesday, 13 June 2018 at 17:08:26 UTC, wjoe wrote:
> My question was more like what's the benefit of having thrown 
> Errors corrupt your program state  rendering it useless for 
> debugging ?

D allows various levels of performance and safety. Though I'd say 
Errors not working in debug mode is not intended, the 
optimization should work in release mode which implies debugged 
code and assumes there are no Errors thrown and you get extra 
optimization for nothrow functions. Errors are a cheap way to 
print diagnostic, because you need to do it for unhandled 
exceptions anyway and it's cross-platform too unlike debugger. 
Also leaf functions don't know anything about environment and 
can't do meaningful I/O, e.g. realistically you have standard 
output only in console applications and not in other applications.


More information about the Digitalmars-d-learn mailing list