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

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

[Octave-bug-tracker] [bug #65342] replace atoi with stoi


From: Rik
Subject: [Octave-bug-tracker] [bug #65342] replace atoi with stoi
Date: Sat, 23 Mar 2024 17:58:10 -0400 (EDT)

Follow-up Comment #6, bug #65342 (group octave):

Question on coding style.  In debug.cc I see


+      try
+        {
+          int line = std::stoi (arg);
+
+          if (line <= 0)
+            error ("%s: start and end lines must be >= 1\n", who);
+
+          start = line;
+          end = line;
+        }
+      catch (const std::invalid_argument&)
+        {
+          // May be a name instead of a number.
+          return false;
+        }
+      catch (const std::out_of_range&)
+        {
+          error ("%s: integer value out of bounds while parsing '%s'", who,
arg.c_str ());
+        }


In the second try block there is a call to to std::stoi and then a check on
line number which calls error().  Will the call to error() in any way be
intercepted by the try block?  If that were the case then the error would get
swallowed because I don't see a catch block that would grab the execution
exception that Octave throws.

At bp-table.cc:443 there is an apparently truncated comment


              // FIXME: I'm not sure what the


I'm getting a warning about an unused variable during compilation now.


libinterp/parse-tree/bp-table.cc: In member function ‘void
octave::bp_table::parse_dbfunction_params(const char*, const
octave_value_list&, std::string&, std::string&, octave::bp_table::bp_lines&,
std::string&)’:
libinterp/parse-tree/bp-table.cc:489:24: warning: unused variable ‘skip’
[-Wunused-variable]
  489 |                   bool skip = false;
      |                        ^~~~


I think this is an accidental inclusion in the cset.






    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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