News for hackers. Stuff that matters.
Re:Tips on writing C macros by dspeyer on Wednesday August 05, 2009 @01:02AM (#742886)
> Passing MyArray[x+3] as a macro argument would lexically copy this expression in multiple locations in the macro expansion, causing the generated code to needlessly evaluate *(Myarray+x+3) again and again and again.

Wouldn't any decent optimizing compiler eliminate those common subexpressions? That's one of the basics, isn't it?

Of course, if you're in a tight enough loop to worry about that, check the assembly by hand.

There are no comments on this comment yet.