Namespace Polluted Mac Domain, Killed Mr. Rect

Well, namespace pollution sucks.

Mac OS X's global struct Rect becomes ambiguous due to a careless use of using namespace in header files.

I'm trying  to compile a certain sample application suite, but I found quite a few of header files of these samples are messed up by namespace pollutions. I tried to keep the original source code as intact as possible by just reordering #include, but I gave up, well, almost I guess.
Arrg, I'll have to surgically remove every careless using namespace ; and instead place namespace  {} in header files…

I filed a question at StackOverflow for any existence of a holy-grail gcc warning option for namespace pollution (Is there a way to warn me Global Namespace Pollutions?). What is sad, alas, is that I'm already pessimistic about it.

Programming is mental labor.


"...This sample application suite worked at the previous revisions. Going through the revision history may solve this amazingly..." That thought crossed my mind. But, using namespace in header files is bad, super baaad. To eradicate the source of evil is one of programmer's jobs.


Attaboy (or attagirl?) Clang! From the answer to StackOverflow question above, warning option -Wusing-directive-in-header or -Wheader-hygiene can be used to warn namespace pollutions in Clang.


Popular posts from this blog

Hardcoding Data Like Images and Sounds into HTML or CSS

DDS for GIMP (Mountain Lion, Native, no X11 GUI)

Make It Work: Global .gitattributes