This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Why are we overusing the preprocessor?
- From: "Jeffrey Turner" <jturner at mail dot alum dot rpi dot edu>
- To: <dosreis at cmla dot ens-cachien dot fr>, <pedwards at disaster dot jaj dot com>, <law at gcc dot gnu dot org>, <gcc at gcc dot gnu dot org>, <libstdc++ at gcc dot gnu dot org>, <nathan at gcc dot gnu dot org>
- To: <nobody at gcc dot gnu dot org>
- Date: Tue, 1 Jan 2002 12:04:08 -0500
- Subject: Why are we overusing the preprocessor?
- Reply-to: <jturner at mail dot alum dot rpi dot edu>
Hello,
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? I mean the Standard Template Library is
kinda a dated term anyway) I was directed to concept_check.h
and from there to boost_concept_check.h. I'm finding what I
think are _far_ too many #defines. #defines, like their
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.
Maybe it's just me, but I tried expanding:
#define _IsUnused __attribute__ ((__unused__))
template < class _Concept > inline void __function_requires()
{
void (_Concept::*x) () _IsUnused = &_Concept::constraints;
}
#define __glibcpp_function_requires(...)
__gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >();
I think it comes out as:
inline void
__gnu_cxx::*__VA_ARGS__ () __attribute__ ((__unused__)) =
&__gnu_cxx::__VA_ARGS__;
but it could be just void instead of inline void and...
I'd bet __VA_ARGS__ is probably something just as horrendous.
Every knowledgeable authority I have read rails against using
the preprocessor, so why is it so commonplace?
--Jeff Turner
Who put the Sam in the "'Sama Laden Ding-Dong"?