ubports/ubuntu-ui-toolkit

Unreachable code

Closed this issue · 3 comments

[/src/UbuntuToolkit/mousetouchadaptor_x11.cpp line 216
Code:

   case XI_Motion:
        return handleMotionNotify(
                static_cast<WId>(xiDeviceEvent->event),
                xiDeviceEvent->mods.base_mods,
                fixed1616ToReal(xiDeviceEvent->event_x),
                fixed1616ToReal(xiDeviceEvent->event_y));
        return true;   // <-- unreachable
    default:
        return false;

Asking from ignorance here: if the first return is invalid, would always return something (null, error, else) or would fall into the second return?

return will always terminate the function so the second value (true) will be not reached.

I see. Thank you