make a nothrow call a throwing function

Jonathan M Davis jmdavisProg at gmx.com
Thu Feb 7 02:52:30 PST 2013


On Thursday, February 07, 2013 11:06:14 monarch_dodra wrote:
> Is there any way that a nothrow function can call a function that
> throws, but without even trying to catch if an exception is
> thrown?
> 
> My use case is a pretty low level nothrow function, that needs to
> call something that never ever throws, but was not marked as such.
> 
> I want to avoid the "try/catch/[do nothing|assert]" because I
> don't want to pay for that. Ideally, i'd really just want to mark
> my function as nothrow, and have undefined behavior if it *does*
> throw.
> 
> Any way to do that?

You can cast the function.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list