3 ms·
> costs of comparison to NULL aren't massive Depends on how often you are doing the comparison. Is it 1 time/second, or 10 million times a second? There is a
by scoutt 6y ago
> costs of comparison to NULL aren't massive
Depends on how often you are doing the comparison. Is it 1 time/second, or 10 million times a second?
There is a difference.
If the code above is the one in charge of putting/removing network packets in a queue, or putting threads ordered by priority for the scheduler, then you should consider the side effects of checking for NULL.
If you are going to implement this function in a library for Jimmy The Programmer[1], then check for NULL.
[1] https://blog.codinghorror.com/new-programming-jargon/ https://blog.codinghorror.com/new-programming-jargon/