If you are a C++ programmer, my blog should give you the creeps. Sometimes because of what I write here,
I guess - but definitely because of its name. You are not alone. The first time someone told me about that
"#define private public" line which he had just found in our codebase, I didn't want to believe that
someone actually did that.
But it was oh so true.
If I remember correctly, there was a reason for it - certainly not a good one, but a
reason: Some experimental test code needed to access a class member which was declared
private
, and
the author of that code wasn't supposed to change the class under test, or did not have
access to it.
This disgusting hack was probably meant as a stopgap solution, but then remained in the code
for way too much time - until it was re-discovered and became a part of our local programming folklore.
I was actually grateful for this hack - without it, I'd probably still be searching for a
name for my blog!
And then, just a few days ago, I came across the following excerpt from the standard for
the C++ standard library (
ISO/IEC 14882:1998(E),
section 17.4.3.1.1):
A translation unit that includes a header shall not contain any macros that define names declared or defined in that header.
Nor shall such a translation unit define macros for names lexically identical to keywords.
Good heavens, my blog is cursed upon by the standard! Expelled will I be from the C++ community!
Never will I be on a first-name basis with
Mr. Stroustrup!
What have I done...
to top