Edit
Attach
Printable
topic end
<!-- * Set TOPICTITLE = #define private public - This blog considered illegal (13 Apr 2008) --> <style type="text/css"> pre {background-color:#ffeecc;} </style> %STARTINCLUDE% <a name="13"></a> ---+++ [[DefinePrivatePublic20080413][This blog considered illegal]] (13 Apr 2008) <summary> 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 "<tt>#define private public</tt>" line which he had just found in our codebase, I didn't want to believe that someone actually did that. </summary> 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 ([[http://www.kuzbass.ru:8086/docs/isocpp/lib-intro.html][ISO/IEC 14882:1998(E)]], section 17.4.3.1.1): <blockquote> A translation unit that includes a header shall not contain any macros that define names declared or defined in that header. <i>Nor shall such a translation unit define macros for names lexically identical to keywords.</i> </blockquote> 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 [[http://www.research.att.com/~bs/][Mr. Stroustrup]]! What have I done... --- %STOPINCLUDE% %COMMENT{type="below" nonotify="on"}% ---
to top
End of topic
Skip to action links
|
Back to top
Edit
|
Attach image or document
|
Printable version
|
Raw text
|
Refresh
|
More topic actions
Revisions: | r1.1
|
Total page history
|
Backlinks
You are here:
Blog
>
DefinePrivatePublic20080413
r1.1 - 13 Apr 2008 - 09:19 -
ClausBrod
to top
Blog
This site
2017
:
12
-
11
-
10
2016
:
10
-
7
-
3
2015
:
11
-
10
-
9
-
4
-
1
2014
:
5
2013
:
9
-
8
-
7
-
6
-
5
2012
:
2
-
10
2011
:
1
-
8
-
9
-
10
-
12
2010
:
11
-
10
-
9
-
4
2009
:
11
-
9
-
8
-
7
-
6
-
5
-
4
-
3
2008
:
5
-
4
-
3
-
1
2007:
12
-
8
-
7
-
6
-
5
-
4
-
3
-
1
2006:
4
-
3
-
2
-
1
2005:
12
-
6
-
5
-
4
2004:
12
-
11
-
10
C++
CoCreate Modeling
COM & .NET
Java
Mac
Lisp
OpenSource
Scripting
Windows
Stuff
Changes
Index
Search
Maintenance
Impressum
Datenschutzerklärung
Home
Webs
Atari
Blog
Claus
CoCreateModeling
Klassentreffen
Main
Sandbox
Sommelier
TWiki
Xplm
Jump:
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback