emacs-devel
[Top][All Lists]
Advanced

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

Re: (0 <= i && i < N) is not "backwards"


From: Eli Zaretskii
Subject: Re: (0 <= i && i < N) is not "backwards"
Date: Mon, 25 Mar 2013 16:53:59 +0200

> Date: Mon, 25 Mar 2013 07:35:51 -0700
> From: Paul Eggert <address@hidden>
> CC: address@hidden, address@hidden
> 
> On 03/25/2013 01:20 AM, Eli Zaretskii wrote:
> 
> > Out of fairness, you introduced this style into Emacs sources
> 
> I've certainly used it in the changes I made, and as a result it's
> become more popular, but I did not introduce it.  That style has
> been used in Emacs, as a minority style, for many years.

AFAIR, it was once a negligible minority at best, so much so that I
don't remember it being used.  That was in the days that the only
style enforced in the Emacs sources was what the GNU Coding Standards
say, btw.  That's what allowed "minority styles" in the first place.

> > If we want our code to be robust in the face of NaNs, we should
> > probably use 'isnan' explicitly
> 
> That will slow the code down and make it harder to read.

I disagree; there's nothing unclear in a call to isnan, and the
slow-down is negligible, if it exists at all, and won't be noticed in
the context of Emacs, which doesn't pretend to be a fast
number-cruncher anyway.

> Perhaps a
> comment could be introduced; but must we really add a comment
> "watch out for NaNs!" every time we have a floating point comparison?

Such comments would be even worse.

But the problem with relying on 0 < foo is that most people won't even
consider the subtle difference between that and !(foo >= 0) when NaNs
are involved.  Calling isnan makes that explicit.

Anyway, this issue is tangential to the style issue.



reply via email to

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