HandsOnOpenCL / Lecture-Slides

Lecture Slide Issue Tracking
Other
245 stars 44 forks source link

Importing both std and cl namespace is a bad idea #24

Closed bmerry closed 9 years ago

bmerry commented 10 years ago

The slide "C++ Interface: setting up the host program" recommends using

using namespace cl;
using namespace std;

However, these namespaces have conflicts, particularly size_t and copy. This can lead to some very strange errors (for example, changing a buffer from cl::Buffer to cl::BufferGL causes the std::copy template to become the best match and it tries to treat cl::BufferGL as an output iterator; or declaring a size_t variable leads to errors because it was expecting a template parameter).

Even if the code works, I think that it is useful to make it clear which things are coming from the cl namespace.

tomdeakin commented 9 years ago

We have removed this in v1.2