* (error (format ...
@ 2005-06-16 13:32 Juanma Barranquero
2005-06-16 13:49 ` David Kastrup
0 siblings, 1 reply; 5+ messages in thread
From: Juanma Barranquero @ 2005-06-16 13:32 UTC (permalink / raw)
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" ""))
--
/L/e/k/t/u
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (error (format ...
2005-06-16 13:32 (error (format Juanma Barranquero
@ 2005-06-16 13:49 ` David Kastrup
2005-06-16 14:03 ` Lennart Borgman
2005-06-16 14:03 ` Juanma Barranquero
0 siblings, 2 replies; 5+ messages in thread
From: David Kastrup @ 2005-06-16 13:49 UTC (permalink / raw)
Cc: emacs-devel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-06-16 14:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-16 13:32 (error (format Juanma Barranquero
2005-06-16 13:49 ` David Kastrup
2005-06-16 14:03 ` Lennart Borgman
2005-06-16 14:03 ` Juanma Barranquero
2005-06-16 14:07 ` David Kastrup
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).