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

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

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


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

Follow-up Comment #2, patch #10217 (project octave):

I see now that this patch is also the file avoidstringctors_2.patch attached
to patch #10147.  There, I added the comment

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? 


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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