runner icon indicating copy to clipboard operation
runner copied to clipboard

C++ test framework pollutes the global namespace

Open nomennescio opened this issue 1 year ago • 1 comments

When trying to run a piece of C++ code similar to:

char c;
int f (void) { return c; }

I got this error message:

./solution.cpp:27:57: error: reference to 'c' is ambiguous
...
/usr/local/include/igloo/core/testrunner.h:17:13: note: candidate found by name lookup is 'igloo::c'
  namespace c = choices;

Where igloo pollutes the global namespace with identifier c, a commonly used one character identifier in regular code. I'm not even sure users are able/required to use that namespace, so why not make it invisible?

nomennescio avatar Apr 14 '23 12:04 nomennescio