emacs-devel
[Top][All Lists]
Advanced

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

Re: (error (format ...


From: David Kastrup
Subject: Re: (error (format ...
Date: Thu, 16 Jun 2005 15:49:20 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Juanma Barranquero <address@hidden> 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




reply via email to

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