From: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: (error (format ...
Date: Thu, 16 Jun 2005 15:49:20 +0200 [thread overview]
Message-ID: <85is0ewgwv.fsf@lola.goethe.zz> (raw)
In-Reply-To: <f7ccd24b050616063233e2034d@mail.gmail.com> (Juanma Barranquero's message of "Thu, 16 Jun 2005 15:32:55 +0200")
Juanma Barranquero <lekktu@gmail.com> writes:
> Is there any reason for uses like this one from simple.el:
>
> (error (format "No further undo information%s"
> (if (and transient-mark-mode mark-active)
> " for region" "")))
>
> instead of simply:
>
> (error "No further undo information%s"
> (if (and transient-mark-mode mark-active)
> " for region" ""))
I'd probably be tempted to use
(error (concat "No further undo information"
(and transient-mark-mode mark-active
" for region")))
in this case. It shares the disadvantage of the original version
(when compared to yours) of being more likely to lead to accidental
format string vulnerabilities if a user takes this as starting code
for something with a variable string.
It is perhaps more educational to preferable follow (error ... with a
constant string.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
next prev parent reply other threads:[~2005-06-16 13:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-16 13:32 (error (format Juanma Barranquero
2005-06-16 13:49 ` David Kastrup [this message]
2005-06-16 14:03 ` Lennart Borgman
2005-06-16 14:03 ` Juanma Barranquero
2005-06-16 14:07 ` David Kastrup
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=85is0ewgwv.fsf@lola.goethe.zz \
--to=dak@gnu.org \
--cc=emacs-devel@gnu.org \
/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.