changeset 31678:96d321d59ee3 stable

doc: Clarify handling of escape sequences in input of error function (bug #63556). * libinterp/corefcn/error.cc (Ferror): Clarify that escape sequences in the template string are not interpreted in single-quoted character vectors unless they are followed by additional arguments.
author Markus Mützel <markus.muetzel@gmx.de>
date Wed, 21 Dec 2022 20:17:13 +0100
parents 9be3a2706d62
children 5c6395400843 6429fec82881
files libinterp/corefcn/error.cc
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/error.cc	Mon Dec 19 10:13:04 2022 -0800
+++ b/libinterp/corefcn/error.cc	Wed Dec 21 20:17:13 2022 +0100
@@ -1175,8 +1175,12 @@
 Format the optional arguments under the control of the template string
 @var{template} using the same rules as the @code{printf} family of
 functions (@pxref{Formatted Output}) and print the resulting message
-on the @code{stderr} stream.  The message is prefixed by the character
-string @samp{error: }.
+on the @code{stderr} stream.  This formatting is only done for
+single-quoted character vectors if there are additional arguments
+following the template string.  If there are no additional arguments, the
+template string is used literally (i.e., without interpreting any escape
+sequences in single-quoted character vectors).  The message is prefixed
+by @samp{error: }.
 
 Calling @code{error} also sets Octave's internal error state such that
 control will return to the top level without evaluating any further