www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/16/11:04:59

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++, complex, etc
Date: 16 May 2000 12:57:41 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 53
Message-ID: <8frgk5$f19$1@nets3.rz.RWTH-Aachen.DE>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000516143426 DOT 24814G-100000 AT is>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 958481861 15401 137.226.32.75 (16 May 2000 12:57:41 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 16 May 2000 12:57:41 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019