coin-or / CoinUtils

COIN-OR Utilities
Other
44 stars 41 forks source link

Remove all "using namespace std" #201

Closed SanPen closed 2 months ago

SanPen commented 1 year ago

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.

StefanBruens commented 1 year ago

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.

SanPen commented 1 year ago

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.

havardAasen commented 9 months ago

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;
tkralphs commented 5 months ago

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 commented 5 months ago

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