CoinUtils icon indicating copy to clipboard operation
CoinUtils copied to clipboard

Remove all "using namespace std"

Open SanPen opened this issue 2 years ago • 5 comments

Hi,

I had an error due to the usage of using namespace std; in several files of the project:

See the error at S.O.

It would be a good idea to remove those.

SanPen avatar Jan 04 '23 21:01 SanPen

I can´t find any using namespace std; in any of the header files.

The problem you see is not an ambiguity between std::malloc and ::malloc, but with arma::superlu::malloc, which has been imported into the global namespace.

I think this Issue is invalid.

StefanBruens avatar Jan 26 '23 21:01 StefanBruens

Well, maybe we downloaded sifferent versions for some reason. But In the code I downloaded it definitelly was there since I had to fix it myself. So if this was fixed, then great.

PD: maybe it is not in the header files, but the CPP files. I was compiling everything in the same project.

SanPen avatar Jan 27 '23 08:01 SanPen

Running the command

grep -rwn "using namespace std"

I got one hit in stable/2.11

CoinUtils/src/CoinLpIO.cpp:31:using namespace std;

for master I got 5 hits

src/CoinAdjacencyVector.cpp:35:using namespace std;
src/CoinStaticConflictGraph.cpp:29:using namespace std;
src/CoinConflictGraph.cpp:33:using namespace std;
src/CoinLpIO.cpp:30:using namespace std;
src/CoinDynamicConflictGraph.cpp:104:using namespace std;

havardAasen avatar Dec 19 '23 11:12 havardAasen

I removed the instance in stable/2.11 in 7c4a14cf337aa0e296b6f5436f1e36cb31336f2f before making release 2.11.11. It was actually superfluous, so it wouldn't have caused issues, but better to get rid of it.

tkralphs avatar Apr 08 '24 16:04 tkralphs

We should still remove the ones in master, but those might require a bit more care.

tkralphs avatar Apr 08 '24 16:04 tkralphs