emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master b7fa6b1 1/4: Simplify use of FOR_EACH_TAIL


From: Paul Eggert
Subject: Re: [Emacs-diffs] master b7fa6b1 1/4: Simplify use of FOR_EACH_TAIL
Date: Mon, 6 Feb 2017 17:35:51 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 02/06/2017 07:37 AM, Eli Zaretskii wrote:
Why is it so important to make sure it doesn't survive the loop?  If
for optimizations, then I'd expect modern compilers to be smart enough
to produce the same code whether it does or doesn't survive.

It's not so much compilers as human readers of the code. Admittedly it is a minor issue.

We have similar macros elsewhere, e.g. FOR_EACH_FRAME,
FOR_EACH_BUFFER, etc.  It's IMO a pity to have this one different.

Good point, I had forgotten about that. I installed the attached patch, which changes FOR_EACH_TAIL to act more like these other macros. That is. FOR_EACH_TAIL (tail) now updates 'tail' each time through the loop, and the caller needs to declare the 'tail' variable outside the loop; this is as it was before.

Attachment: 0001-Make-FOR_EACH_TAIL-more-like-other-FOR_EACH-macros.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]