Code review comment for lp:~mc-return/compiz/compiz.merge-performance-do-not-assign-values-that-are-never-used

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I agree the nicest way to achieve this is usually to do it on a single line:
    Foo *x = something
However that's only valid in C++ and not in C.

So in C, I think the existing redundant initialization is the preferred method of defence.

Also note, this is not a significant performance issue. Assigning a word-sized variable to zero or NULL is such a simple instruction that any modern CPU from the last 20 years can do several of them per clock cycle. You'd have to be doing millions or billions of redundant assignments for it to be a problem (for example in a very tight performance-sensitive loop).

review: Disapprove

« Back to merge proposal