This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] float, double & complex template non-type parms
- To: Wolfram dot Gloger at dent dot med dot uni-muenchen dot de, gcc at gcc dot gnu dot org
- Subject: Re: [C++] float, double & complex template non-type parms
- From: Mike Stump <mrs at windriver dot com>
- Date: Wed, 28 Feb 2001 09:10:41 -0800 (PST)
> Date: Tue, 27 Feb 2001 10:05:29 +0100 ("MET)
> From: Wolfram Gloger <Wolfram.Gloger@dent.med.uni-muenchen.de>
> To: gcc@gcc.gnu.org
> > The arguments against:
> ...
> You forgot the very important:
> - They enable you to write a C++ program that can compute a picture of
> the Mandelbrot set _at compile time_. With only integer arithmetic
> that is much less fun..
Further, some algorithms demand floating point. Take for example, IIR
and FIR filters. These are things that can be staticaly generated at
compile time, if you know what type of filter you want, but to
generate them, you want floating point. The speedup is enormous _if_
you statically generate them. A natural use of C++ would have it
generate all the coefficients at compile time, then at runtime you're
down to just multiplies and adds. By not having floating point, one
is then forced to either have a floating point emulation library, or
to find some other technique.
Further, I've seen people use floating arguments to do series
expansions to get trigonometric functions at compile time, so that
they don't have to waste time at runtime to get the values.
I don't really know if these are or should be compelling cases, but, I
would rather offer the feature to users and let them decide. This
type of coding is still young and there is little experience with it
still, by offering it for another few years, we can tell if users
would rather not have the feature (they won't use the feature), or if
they find it indispensable. If we remove it now, they don't get to
play with it.
How about just a pedwarn for now? People that care can know it isn't
portable, and those that want to try and use it, can.