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

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

[Octave-bug-tracker] [bug #65321] C++20 warnings about deprecated uses o


From: Rik
Subject: [Octave-bug-tracker] [bug #65321] C++20 warnings about deprecated uses of volatile variables
Date: Mon, 19 Feb 2024 19:11:30 -0500 (EST)

Follow-up Comment #14, bug#65321 (group octave):

Remaining instances of volatile are


liboctave/array/CSparse.cc:5300:                  volatile double
rcond_plus_one = rcond + 1.0;
liboctave/array/CSparse.cc:5470:                  volatile double
rcond_plus_one = rcond + 1.0;
liboctave/array/CSparse.cc:5633:      volatile double rcond_plus_one = rcond +
1.0;
liboctave/array/CSparse.cc:5783:              volatile double rcond_plus_one =
rcond + 1.0;
liboctave/array/CSparse.cc:6032:              volatile double rcond_plus_one =
rcond + 1.0;
liboctave/array/CSparse.cc:6314:              volatile double rcond_plus_one =
rcond + 1.0;
liboctave/array/CSparse.cc:6542:              volatile double rcond_plus_one =
rcond + 1.0;
liboctave/array/CSparse.cc:6677:              volatile double rcond_plus_one =
rcond + 1.0;
liboctave/util/quit.cc:41:volatile std::atomic<bool>
octave_signal_caught{false};
liboctave/util/quit.h:229:extern OCTAVE_API volatile std::atomic<bool>
octave_signal_caught;


jwe asked if we could do this better.  Maybe?  Taking just one example, the
code is


                  volatile double rcond_plus_one = rcond + 1.0;

                  if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))


What we seem to want to check is if the reciprocal condition number is zero. 
Would it be possible to substitute a less-than-equal comparison with eps?  In
pseudo-code


if (abs (rcond) <= eps)


The absolute value function could be "std::abs" and eps could come from
"std::numeric_limits<double>::epsilon".

I can't evaluate other two instances of volatile in quit.h and quit.cc.  But,
I did look at cppreference.com and their examples do not use volatile in
conjunction with std::atomic.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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