newbie problem with nothrow

WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 31 09:55:51 PDT 2016


Is there a way to turn off nothrow or work around it? Because to 
me it looks like nothrow prevents me from doing anything useful.

extern(C) void onKeyEvent(GLFWwindow* window, int key, int 
scancode, int action, int modifier) nothrow
{
     if(queue.roomInQueue())
     {
         auto event = new Event;
         event.type = EventType.keyboard;
         event.keyboard.key = cast(Key) key;

         // etc.
}

Error: function 'event_handler.CircularQueue.roomInQueue' is not 
nothrow
Error: function 'event_handler.onKeyEvent' is nothrow yet may 
throw


The compiler wouldn't let me just remove "nothrow" from the 
function. I tried a kludge where I had this function just pass 
all its parameters to another throwable function, but this caused 
errors as well.

So I'm stuck.  Anyone know how to proceed.
Thanks.



More information about the Digitalmars-d-learn mailing list