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

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

[Octave-patch-tracker] [patch #10216] interpreter: Avoid string construc


From: John W. Eaton
Subject: [Octave-patch-tracker] [patch #10216] interpreter: Avoid string construction 1
Date: Wed, 22 Jun 2022 12:55:21 -0400 (EDT)

Follow-up Comment #1, patch #10216 (project octave):

Another possibility is to define these functions to accept "const char *"
instead of "const std::string&" objects.  Almost all uses pass literal strings
anyway.  We could also still provide the "const std::string&" signature as an
inline wrapper function.

OTOH..  The "who" argument that is used in the error messages was intended to
help with debugging.  But these are internal private functions that are not
intended to be part of the public API (the interpreter-private.h file is not
installed).  And in http://hg.savannah.gnu.org/hgweb/octave/rev/5cb3a2bb5e1e I
changed the __get_interpreter_function__ to do this:


    if (! interp)
      {
        abort ();
        error ("%s: interpreter context missing", who.c_str ());
      }


so the error message will never be displayed.  I'm not sure why I did that. 
Maybe I was just trying to do some debugging and forgot to remove the call to
abort when I was done?  Or maybe it was because calling "error" requires the
interpreter to be present (oops!).  Anyway, maybe it would be simpler to just
remove the "who" argument and if one of these functions is called when there
is no interpreter object available, just print a simple message to std::cerr
and abort?

I made that change here: 
http://hg.savannah.gnu.org/hgweb/octave/rev/670a0d878af1


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?10216>

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




reply via email to

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