in reply to To warn or not to warn, that is the question
I'm all for optimization, when appropriate, but my corrolary to gnat's law is, "A program that executes completely -- but could be made to run slightly faster with slightly dodgier programming -- is faster than a program that falls over when it hits something you didn't plan for."
Depending on your design (specifically the abstraction and encapsulation), it may be appropriate to declare that your subroutine always returns numeric values. It may not. If there's a chance that the return value is undefined, I'd definitely do the check.
If that's the last optimization point in my program, I've done really, really well.
|
|---|