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

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

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


From: John W. Eaton
Subject: [Octave-patch-tracker] [patch #10147] interpreter: Avoid string construction
Date: Tue, 28 Feb 2023 09:20:54 -0500 (EST)

Follow-up Comment #7, patch #10147 (project octave):

The first patch is irrelevant now because the functions like __get_load_path__
no longer accept arguments.

For the second patch, I generally dislike returning pointers or references to
internal data members, even if they are constant because it means the
programmer needs to ensure that the lifetime of the containing object is
longer than the reference to the internal data, and that there are no changes
to the containing object that will invalidate the reference or change the
value that it refers to unexpectedly.  It seems to me that it is easy to miss
details like this when refactoring code in the future, and that can lead to
hard to find bugs.  To me, the possible maintenance issues outweigh the
performance gains.  Maybe there is another way to do this job that doesn't
have the possible maintenance issues?

In the third patch, I agree that setting retval = "" (the first part of the
diff) is unnecessary, but setting dir_name = "" in the other two bits of the
diff ensures that dir_name is empty if no valid function is found.  That seems
reasonable to me, as the user of the function might have passed something else
and setting it to "" could avoid later confusion.  I understand these are
"internal" functions and that maybe fcn_info "is not supposed to be used that
way" but I tend to worry about future maintenance.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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