Hello Alex and Greg,
[...]
This could just be:
if (drv) return drv->pm;
return NULL;
Or if you want to evoke passion in Greg:
return drv ? drv->pm : NULL;
-Alex
I hate ? : lines with a passion, as they break normal pattern mattching in my brain. Please just spell this all out: if (drv && drv->pm) return drv->pm; return NULL;
Much easier to read, and the compiler will do the exact same thing.
Only place ? : are ok to use in my opinion, are as function arguments.
I will steer away from the ternary operator next time. Also, good to learn about Greg's preference.
Thank you both!
Krzysztof