Mail Archives: djgpp/2000/05/16/11:04:59
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> So what is the standard C++ complex type?
There is no such thing as 'the' standard type. 'complex' is realized
as a template, so you can have either of
complex<double>
complex<float>
complex<long double>
or probably even
complex<char>
complex<int>
(haven't really checked that), after you included the right header
finally named <complex> by the ANSI/ISO C++ committee.
> How do I declare a complex variable in a way that any
> standard-complying C++ compiler should support?
The problem in that sentence is the term'standard-complying'. The C++
language has been standardized only relatively recently (end of 1998,
if memory serves), and many compiler or library implementors haven't
caught up with that development, yet. G++ is mostly there (partly
depending on some tricky details of the binutils and platform you're
using), but the library, libstdc++, still seems to be lacking in some
areas.
The *real* problem however is that C++ standardization was such a
long, yet dynamic process. Several authors and publishers couldn't
resist the temptation of producing 'teach yourself' and 'for dummies'
style C++ books that describe non-standard dialects of the language.
At some point in time they somewhat correctly claimed to be close to
the developing standard, but have in the meantime been overtaken by
reality. Sadly, lots of those books are still around, in libraries and
bookshops, and people take their claim at face value. The fact that
hardly any currently available compiler supports 100% of ANSI/ISO
standard C++ yet adds to the problem significantly.
Thus many of the books out there are very often even further behind
the standardization process than the compilers and libraries
are. That's how people come to disagree over things like <iostream.h>
vs. <iostream>, or the libg++ complex class (<Complex.h>?) vs. the
Standard template in <complex>. C++ itself has stopped being the
rapidly moving target it used to be, when the standard was accepted at
last, but the aftermath of its sometimes jumpy evolution is not over,
yet. Lots of people have yet to catch up to the standard, before C++
can be considered a 'stable' language.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -