Why are we overusing the preprocessor?
Phil Edwards
pedwards@disaster.jaj.com
Wed Jan 2 14:19:00 GMT 2002
I don't know why you Cc'd nobody@gcc.gnu.org, or individual people for
that matter...
On Tue, Jan 01, 2002 at 12:04:08PM -0500, Jeffrey Turner wrote:
> In going through stl_algo.h (Wouldn't it be easier to distinguish
> these headers from the std_xxxx.h headers if we called them
> gnu_xxxx.h instead?
stl_* files were imported from the HP/SGI version a few years back.
the std_ files may or may not be going away.
It's not very difficult to distinguish them if you read the documentation.
Renaming files in CVS is enough of a pain that we don't do it very often.
> preprocessor cousins #includes, tend to obfuscate things
> by making one search/grep all over the place to figure out the
> real meaning of a statement. I know the theory is that brevity
> is a blessing - but, IMHO, not at the expense of clarity.
Have you seen how the constructs are /used/ rather than looking at how
they are /defined/?
When the definition for std::vector<_Tp> starts off with
__glibcpp_class_requires(_Tp, _SGIAssignableConcept)
I think that's a major win for clarity /and/ brevity. Try replacing that
with what it expands into -- and don't forget you'll end up with "#ifdef
_GLIBCPP_CONCEPT_CHECKS" everywhere, because the resulting expansion isn't
always active.
The preprocessor is like any other tool or weapon. Its mere existence
isn't necessarily evil; how we use it makes it good or bad. Don't go
ripping out uses that don't have a better replacement. Or for that matter,
that have no replacement at all.
Phil
--
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams
More information about the Gcc
mailing list