openfoam-adapter icon indicating copy to clipboard operation
openfoam-adapter copied to clipboard

Replace raw pointers with std::vector / Foam::autoPtr

Open MakisH opened this issue 6 years ago • 4 comments

We use several raw pointers throughout the code. We should replace them by std:vector (or std::array) or unique_ptr wherever possible.

MakisH avatar Dec 20 '18 11:12 MakisH

For smart pointers we should probably not use unique_ptr: it would be ugly, as we should not use make_unique, which is C++14 (OpenFOAM requires C++11, although preCICE requires C++14, so it probably does not matter).

In any case, OpenFOAM seems to offer similar functionality: autoPtr.H.

Description
    Pointer management similar to std::unique_ptr, with some additional
    methods and type checking.

MakisH avatar Jun 30 '20 17:06 MakisH

Raw pointers, delete, new, .... etc should not appear in modern C++ as long as needed ;)

TEFEdotCC avatar Nov 05 '20 22:11 TEFEdotCC

@MakisH

OpenFOAM requires C++11, although preCICE requires C++14, so it probably does not matter

C++ standard and ABI are different --> So it does not matter which standard you use to build your code. Only the ABI must be compatible. ABI on one Linux system is the same :)

Edit: The target library must be able to read the corresponding interface

TEFEdotCC avatar Nov 14 '20 23:11 TEFEdotCC

Thanks! My worry is not about ABI, it is about sticking to the minimum requirements of the solver, as we also want to target older systems (usually compute clusters). But again, preCICE already requires C++14, so it does not matter. :)

MakisH avatar Nov 15 '20 17:11 MakisH