>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)srce.hr> writes:
> For macros that have statement semantics, e.g. using do {} while
> (0), as opposed to expression semantics, it is always possible to
> eliminate multiple evaluation, and we should do so consistently. I
> have been adding this kind of macro hygiene in the XEmacs sources
> for a while now.
Hrvoje> Do the added automatic variables make a difference?
Unless the compiler is very stupid, adding a new auto variable can
only make the code faster, not slower. C is not Elisp. At run time,
an auto variable no longer exists, since it has been turned into just
a memory reference (or a register reference). Computing an
intermediate result would require the same code, and the compiler has
the extra job of doing common subexpression elimination. It's
dynamically scoped variables that makes variable references so
expensive in Elisp, and another reason why rewriting a function from
elisp to C can make it up to 30 times faster.
But don't believe me - benchmark it!
Martin