Re: Conditional compilation sans the cpp
From: Steven T. Hatton (susudata_at_setidava.kushan.aa)
Date: 08/18/04
- Next message: DaKoadMunky: "New operator -- construction a side-effect?"
- Previous message: lilburne: "Re: Rectangle: struct or class?"
- In reply to: Karl Heinz Buchegger: "Re: Conditional compilation sans the cpp"
- Next in thread: Karl Heinz Buchegger: "Re: Conditional compilation sans the cpp"
- Reply: Karl Heinz Buchegger: "Re: Conditional compilation sans the cpp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 18 Aug 2004 07:43:06 -0400
Karl Heinz Buchegger wrote:
> "Steven T. Hatton" wrote:
>>
>> I've made no secret of the fact that I really dislike the C preprocessor
>> in
>> C++. No aspect of the language has caused me more trouble. No aspect of
>> the language has cause more code I've read to be difficult to understand.
>> I've described it as GOTO's on steroids, and that's what it is!.
>>
>> One argument against abolishing it it that it is useful for conditional
>> compilation when porting code, etc. Well, it seems to me C++ supports
>> that
>> natively. According to TC++PL(SE) §24.3.7.2 if a block of code is
>> bracketted with an if(CONDITION){...} the entire expression is "compiled
>> away" when CONDITION==false.
>
> But it nevertheless runs through the compiler.
It would appear that is the case with g++. I doesn't simply ignore
unreachable code. I know Stroustrup and some others have been playing with
a design for some kind of macro firewall that is supposed to isolate code
from an effects from the preprocessor. But that can't be completely
effective. The CPP is capable of rewriting any code not exclusively
protected, and if you depend on any of the stuff it mangles, all bets are
off.
I fully understand that the CPP has been used to to some great stuff. The
damn thing's been around since the mid 70s or so. It couldn't have
survived this long if it wasn't useful. I probably have most of my major
problems with understanding what it's doing to me under normal
circumstances behind me. OTOH, if Stroustrup has been stung by other
people's macros mangling his code, I'm sure it can and will happen to a
mere mortal like me.
Not only that, but take a look at a translation unit some time. I was in
shock when I saw everything the CPP sucked in to build a tiny little file.
There's got to be a better way!
-- STH Hatton's Law: "There is only One inviolable Law" KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com Mozilla: http://www.mozilla.org
- Next message: DaKoadMunky: "New operator -- construction a side-effect?"
- Previous message: lilburne: "Re: Rectangle: struct or class?"
- In reply to: Karl Heinz Buchegger: "Re: Conditional compilation sans the cpp"
- Next in thread: Karl Heinz Buchegger: "Re: Conditional compilation sans the cpp"
- Reply: Karl Heinz Buchegger: "Re: Conditional compilation sans the cpp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|