Pcl: Remove using namespace std

Created on 16 Jul 2019  路  7Comments  路  Source: PointCloudLibrary/pcl

I suggest to remove using namespace std (only std, but not e.g. std::chrono_literals). Reason: There are some math function which exists as C method and as C++, so it is unclear which the compiler is using.

Example:
https://github.com/PointCloudLibrary/pcl/blob/816391762918f3a026b1822fe42c74bb83129eb4/features/src/pfh.cpp#L67
Here acos is used, which only accepts double values, during std::acos have different overloadings (e.g. for float). Currently you have always to check if there is an using namespace std to get an idea, which version is used. If we disallow usage of using namespace std it is always clear, that acos without std:: isn't the wanted code by us.

medium good first issue todo

Most helpful comment

I am a proponent of not using using namespace std neither in headers, nor in implementation files. I believe our headers are already clean of this, but cpp files are probably not. If you are up for the challenge of removing these, you have my full support.

All 7 comments

I am a proponent of not using using namespace std neither in headers, nor in implementation files. I believe our headers are already clean of this, but cpp files are probably not. If you are up for the challenge of removing these, you have my full support.

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

1 header is still a culprit: cuda/segmentation/include/pcl/cuda/segmentation/mssegmentation.h

Lots of cpp files though (209) including one header file which is using std inside octree namespace: io/include/pcl/compression/color_coding.h

I'm trying to push changes for this issue, but I keep getting:

ERROR: Permission to PointCloudLibrary/pcl.git denied to gnawme.

Do I need to request access first? This happens on two different machines in two different OSes.

You need to push to your fork and then open a PR. PointCloudLibrary/pcl is protected

I'm trying to push my branch so I can open a PR, like so:

git push -u origin norm.evangelista/PCL-3235-remove-namespace-std

Your remote (say origin or fork) needs to point to your fork: https://github.com/gnawme/pcl.git. Once this is done, you just need git push -u fork <branch-name>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jacquelinekay picture jacquelinekay  路  5Comments

dsravankumar1987 picture dsravankumar1987  路  4Comments

nh2 picture nh2  路  5Comments

SergioRAgostinho picture SergioRAgostinho  路  4Comments

dooxe picture dooxe  路  3Comments