octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #59065] Newline in first argument of input() i


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #59065] Newline in first argument of input() is not processed with single-quoted strings
Date: Fri, 4 Sep 2020 22:24:20 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #2, bug #59065 (project octave):

Matlab doesn't do \n conversion when creating strings when using either single
quotes to create char arrays or double quotes to create string objects.  So it
always applies some conversion automatically in specific instances, like the
format argument for the fprintf or sprintf functions.  The weird thing about
this discovery for input is that it appears to only apply to \n, not other
escape sequences, not even \t.  Is that correct?!?  If so, maybe this one
deserves a "WTF, Matlab?!?" tag?

If we decide to attempt compatibility here, we can't just do the same thing we
do with other functions like fprintf when the format is a single-quoted
character string.  We'll have to specifically handle only only \n.

For fprintf, for example, string escapes are handled in the
stream::printf (const octave_value&, const octave_value_list&, const
std::string&) function by calling do_string_escapes.

If necessary, I guess we could have an optional argument to do_string_escapes
that says which escapes to recognize?

The do_string_escapes function is defined in libinterp/corefcn/utils.cc.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59065>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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