opEquals nothrow

Anonymouse via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 20 08:49:57 PDT 2017


On Thursday, 20 July 2017 at 15:10:24 UTC, Aldo wrote:
> extern(C) nothrow
> {
>     void onMouseClick(GLFWwindow* window, int button, int 
> action, int d)
>     {
>        try
>        {
>            // my code
>        }
>        catch
>        {
>
>        }
>     }
> }

Tangent but an easy way of nothrowing:

extern(C) nothrow
{
     void onMouseClick(GLFWwindow* window, int button, int action, 
int d)
     {
         scope(failure) return;

         // my throwing code
     }
}

or scope(failure) return -1; if working with error codes.


More information about the Digitalmars-d-learn mailing list