- 15,524
- 769
Because it didn't look like you were talking about the for keyword. I still don't understand your objection.Jocko Homo said:I am very curious to know how on God's green Earth it could "appear" as if I'm talking about the auto keyword. Can you please explain this to me?
In the eyes of many, using the preprocessor for anything but the standard one-time include guard (#ifndef NAME/#define NAME) and #include statements is language hacking. Abuse of the preprocessor is standard fare for the IOCCC. For your amusement / disgust, here's a winning IOCCC entry written by Jim Hague back in 1986 that translates ascii to Morse code, with the ascii text read from standard input:You don't have to use Boost in particular. What Boost demonstrates is that you can do range-based for loops (as I now know they're called) with the language already. You didn't have to resort to language hacking...
Code:
#define DIT (
#define DAH )
#define __DAH ++
#define DITDAH *
#define DAHDIT for
#define DIT_DAH malloc
#define DAH_DIT gets
#define _DAHDIT char
_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:"
;main DIT DAH{_DAHDIT
DITDAH _DIT,DITDAH DAH_,DITDAH DIT_,
DITDAH _DIT_,DITDAH DIT_DAH DIT
DAH,DITDAH DAH_DIT DIT DAH;DAHDIT
DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT
__DAH;_DIT==DAH_DIT DIT _DIT DAH;__DIT
DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH
DAH_;__DIT DIT DITDAH
_DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT
DIT' 'DAH,DAH_ __DAH DAH DAHDIT DIT
DITDAH DIT_=2,_DIT_=_DAH_; DITDAH _DIT_&&DIT
DITDAH _DIT_!=DIT DITDAH DAH_>='a'? DITDAH
DAH_&223:DITDAH DAH_ DAH DAH; DIT
DITDAH DIT_ DAH __DAH,_DIT_ __DAH DAH
DITDAH DIT_+= DIT DITDAH _DIT_>='a'? DITDAH _DIT_-'a':0
DAH;}_DAH DIT DIT_ DAH{ __DIT DIT
DIT_>3?_DAH DIT DIT_>>1 DAH:'\0'DAH;return
DIT_&1?'-':'.';}__DIT DIT DIT_ DAH _DAHDIT
DIT_;{DIT void DAH write DIT 1,&DIT_,1 DAH;}
The entirety of C++ libraries are implemented using the preprocessor? Where did you get that idea? Most of the C++ library is in the form of templates. The preprocessor doesn't know beans about templates.With that said, yes, it does use a macro and this is less than ideal. However, it is a well behaved macro and it's not as if macros aren't an integral part of C++. Hell, the entirety of C++ libraries are implemented using the preprocessor...