opensubscriber
   Find in this group all groups
 
Unknown more information…

e : emacs-devel@gnu.org 16 June 2005 • 9:49PM -0400

Re: (error (format ...
by David Kastrup

REPLY TO AUTHOR
 
REPLY TO GROUP




Juanma Barranquero <lekktu@gmai...> 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


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu....
http://lists.gnu.org/mailman/listinfo/emacs-devel

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.