From: Lars Ingebrigtsen <larsi@gnus.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 19208@debbugs.gnu.org, Phillip Lord <phillip.lord@newcastle.ac.uk>
Subject: bug#19208: replace-match unhelpful error message
Date: Sat, 03 Aug 2019 22:31:17 +0200 [thread overview]
Message-ID: <87imrec7oq.fsf@mouse.gnus.org> (raw)
In-Reply-To: <e5164f5d-38ee-660c-39b7-5bd564d587e3@cs.ucla.edu> (Paul Eggert's message of "Sat, 3 Aug 2019 13:22:26 -0700")
Paul Eggert <eggert@cs.ucla.edu> writes:
>> No, that's just another sanity check -- num_regs is the max allowed
>> number of sub-matches. (I've now added some comments to clarify.)
>
> Unfortunately that patch messes up the sanity check, as the patched
> code allows 'sub' to be negative, or to be equal to
> search_regs.num_regs, and in either case this results in a bad
> pointer.
Sorry; thanks for fixing.
>> Yoda conditionals and a !...
>
> Actually those were Leibniz conditionals, which are comparisons
> involving "<" or "<=". The idea is that the conditionals' textual
> order reflects numeric order. This is a common style in math when
> doing range checking, e.g., "0 <= i < n". Yoda conditionals are
> expressions like "0 != x" which I agree are confusing.
Well, I think both are called Yoda conditionals, and they are
demonstrably confusing for people not used to seeing conditionals
written that way, which is I think pretty much everybody, except four
people working on Emacs. :-)
In real life, nobody says "if 62 is less than your age, you're eligible
for Medicare". I think one should write code for legibility -- but
opinions on what's legible various, of course. Reading "if (62 < age)",
for me, requires mental gymnastics.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2019-08-03 20:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-28 17:00 bug#19208: replace-match unhelpful error message Phillip Lord
2019-08-03 14:01 ` Lars Ingebrigtsen
2019-08-03 20:22 ` Paul Eggert
2019-08-03 20:31 ` Lars Ingebrigtsen [this message]
2019-08-03 20:50 ` Paul Eggert
2019-08-04 9:09 ` Andreas Schwab
2019-08-03 23:59 ` Noam Postavsky
2019-08-04 9:02 ` Andreas Schwab
2019-08-04 14:12 ` Noam Postavsky
2019-08-04 15:13 ` Andreas Schwab
2019-08-04 17:41 ` Paul Eggert
2019-08-04 18:14 ` Andreas Schwab
2019-08-05 2:25 ` Richard Stallman
2019-08-04 11:47 ` Lars Ingebrigtsen
2019-08-04 9:18 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87imrec7oq.fsf@mouse.gnus.org \
--to=larsi@gnus.org \
--cc=19208@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=phillip.lord@newcastle.ac.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.