Closed gruenich closed 10 months ago
This looks good to me in general.
But using malloc
, calloc
, ... and free
isn't really C++-style anyway. So, I don't know why you'd use C++-style casts here. (It doesn't hurt though afaict.)
Would it be possible to use new []
and delete []
operators instead?
All the packages in SuiteSparse have to be able to use the same underlying memory management routines. That's why I have SuiteSparse_malloc and friends. If I use new and delete then they'd have to be placement new and such, with malloc underneath.
So, I don't know why you'd use C++-style casts here. (It doesn't hurt though afaict.)
You are right. I have an agenda:
-Wall -Wpedantic
. This is mostly done, I am satisfied.std::array
or similar.I plan to do this in smaller steps, as Tim's unusual constraints (no judging) require some changes to be thrown away.
The constraints I have on malloc/free are due to the use of SuiteSparse in many applications, and I can't change it without breaking them. Nearly all large applications impose a uniform control over their memory allocations, and I have to follow that or else the code cannot be used. It's not my constraint.
ParU needs lots of work, for these things and more. I need to think through the entire API in particular.
I'd like to do that after I release a stable 7.4.0, however. So I would like to wait and merge it in a couple days.
I can merge it just after I release a stable 7.4.0.
Oh ... I just merged it into the wrong branch. I missed that. Please apply all PR's to the dev2 branch, not dev.
I tried to use
reinterpret_cast
, too. Cppcheck warns that these could be potentially not portable (casting betweenlong
anddouble
) and GCC does not accept these casts withinconstexpr
functions. Thus, I retract my changes to introduceconstexpr
andreinterpret_cast
. Probably C++20's provides a portable solution bystd::bit_cast
.