[multiple changes]

Sat Sep 27 16:48:00 1997  Jason Merrill  <jason@yorick.cygnus.com>

	* std/complext.h: Lose injection decls.
	* std/fcomplex.h: Likewise.
	* std/dcomplex.h: Likewise.
	* std/ldcomplex.h: Likewise.

Sat Sep 27 16:47:35 1997  Mark Mitchell  <mmitchell@usa.net>

	* std/complext.h: Declare templates before making them
	friends.  Use new friend <> syntax.
	* std/complext.cc: Don't rely on guiding declarations.
	* std/fcomplex.h: Use new friend <> syntax.
	* std/dcomplex.h: Likewise.
	* std/ldcomplex.h: Likewise.

From-SVN: r15776
This commit is contained in:
Jason Merrill 1997-09-28 15:21:52 -04:00
parent 920253a3bc
commit 905a881f36
7 changed files with 45 additions and 140 deletions

View File

@ -1,3 +1,19 @@
Sat Sep 27 16:48:00 1997 Jason Merrill <jason@yorick.cygnus.com>
* std/complext.h: Lose injection decls.
* std/fcomplex.h: Likewise.
* std/dcomplex.h: Likewise.
* std/ldcomplex.h: Likewise.
Sat Sep 27 16:47:35 1997 Mark Mitchell <mmitchell@usa.net>
* std/complext.h: Declare templates before making them
friends. Use new friend <> syntax.
* std/complext.cc: Don't rely on guiding declarations.
* std/fcomplex.h: Use new friend <> syntax.
* std/dcomplex.h: Likewise.
* std/ldcomplex.h: Likewise.
Thu Sep 25 19:55:56 1997 Jason Merrill <jason@yorick.cygnus.com>
* std/bastring.h: Enable exceptions.

View File

@ -236,7 +236,7 @@ pow (const complex<FLOAT>& xin, int y)
if (y < 0)
{
y = -y;
x = 1/x;
x = FLOAT(1)/x;
}
for (;;)
{

View File

@ -41,6 +41,16 @@ class istream;
class ostream;
extern "C++" {
template <class _FLT> class complex;
template <class _FLT> complex<_FLT>&
__doapl (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT> complex<_FLT>&
__doami (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT> complex<_FLT>&
__doaml (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT> complex<_FLT>&
__doadv (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT>
class complex
{
@ -55,40 +65,10 @@ public:
private:
_FLT re, im;
friend complex& __doapl (complex *, const complex&);
friend complex& __doami (complex *, const complex&);
friend complex& __doaml (complex *, const complex&);
friend complex& __doadv (complex *, const complex&);
// These functions are specified as friends for purposes of name injection;
// they do not actually reference private members.
friend _FLT real (const complex&) __attribute__ ((const));
friend _FLT imag (const complex&) __attribute__ ((const));
friend complex operator + (const complex&, const complex&) __attribute__ ((const));
friend complex operator + (const complex&, _FLT) __attribute__ ((const));
friend complex operator + (_FLT, const complex&) __attribute__ ((const));
friend complex operator - (const complex&, const complex&) __attribute__ ((const));
friend complex operator - (const complex&, _FLT) __attribute__ ((const));
friend complex operator - (_FLT, const complex&) __attribute__ ((const));
friend complex operator * (const complex&, const complex&) __attribute__ ((const));
friend complex operator * (const complex&, _FLT) __attribute__ ((const));
friend complex operator * (_FLT, const complex&) __attribute__ ((const));
friend complex operator / (const complex&, const complex&) __attribute__ ((const));
friend complex operator / (const complex&, _FLT) __attribute__ ((const));
friend complex operator / (_FLT, const complex&) __attribute__ ((const));
friend bool operator == (const complex&, const complex&) __attribute__ ((const));
friend bool operator == (const complex&, _FLT) __attribute__ ((const));
friend bool operator == (_FLT, const complex&) __attribute__ ((const));
friend bool operator != (const complex&, const complex&) __attribute__ ((const));
friend bool operator != (const complex&, _FLT) __attribute__ ((const));
friend bool operator != (_FLT, const complex&) __attribute__ ((const));
friend complex polar (_FLT, _FLT) __attribute__ ((const));
friend complex pow (const complex&, const complex&) __attribute__ ((const));
friend complex pow (const complex&, _FLT) __attribute__ ((const));
friend complex pow (const complex&, int) __attribute__ ((const));
friend complex pow (_FLT, const complex&) __attribute__ ((const));
friend istream& operator>> (istream&, complex&);
friend ostream& operator<< (ostream&, const complex&);
friend complex& __doapl<> (complex *, const complex&);
friend complex& __doami<> (complex *, const complex&);
friend complex& __doaml<> (complex *, const complex&);
friend complex& __doadv<> (complex *, const complex&);
};
// Declare specializations.
@ -142,9 +122,6 @@ complex<_FLT>::operator *= (const complex<_FLT>& r)
return __doaml (this, r);
}
template <class _FLT> complex<_FLT>&
__doadv (complex<_FLT>* ths, const complex<_FLT>& r);
template <class _FLT>
inline complex<_FLT>&
complex<_FLT>::operator /= (const complex<_FLT>& r)

View File

@ -50,40 +50,10 @@ public:
private:
double re, im;
friend complex& __doapl (complex *, const complex&);
friend complex& __doami (complex *, const complex&);
friend complex& __doaml (complex *, const complex&);
friend complex& __doadv (complex *, const complex&);
// These functions are specified as friends for purposes of name injection;
// they do not actually reference private members.
friend double real (const complex& x) { return x.real (); }
friend double imag (const complex& x) { return x.imag (); }
friend complex operator + (const complex&, const complex&) __attribute__ ((const));
friend complex operator + (const complex&, double) __attribute__ ((const));
friend complex operator + (double, const complex&) __attribute__ ((const));
friend complex operator - (const complex&, const complex&) __attribute__ ((const));
friend complex operator - (const complex&, double) __attribute__ ((const));
friend complex operator - (double, const complex&) __attribute__ ((const));
friend complex operator * (const complex&, const complex&) __attribute__ ((const));
friend complex operator * (const complex&, double) __attribute__ ((const));
friend complex operator * (double, const complex&) __attribute__ ((const));
friend complex operator / (const complex&, const complex&) __attribute__ ((const));
friend complex operator / (const complex&, double) __attribute__ ((const));
friend complex operator / (double, const complex&) __attribute__ ((const));
friend bool operator == (const complex&, const complex&) __attribute__ ((const));
friend bool operator == (const complex&, double) __attribute__ ((const));
friend bool operator == (double, const complex&) __attribute__ ((const));
friend bool operator != (const complex&, const complex&) __attribute__ ((const));
friend bool operator != (const complex&, double) __attribute__ ((const));
friend bool operator != (double, const complex&) __attribute__ ((const));
friend complex polar (double, double) __attribute__ ((const));
friend complex pow (const complex&, const complex&) __attribute__ ((const));
friend complex pow (const complex&, double) __attribute__ ((const));
friend complex pow (const complex&, int) __attribute__ ((const));
friend complex pow (double, const complex&) __attribute__ ((const));
friend istream& operator>> (istream&, complex&);
friend ostream& operator<< (ostream&, const complex&);
friend complex& __doapl<> (complex *, const complex&);
friend complex& __doami<> (complex *, const complex&);
friend complex& __doaml<> (complex *, const complex&);
friend complex& __doadv<> (complex *, const complex&);
};
inline complex<float>::complex (const complex<double>& r)

View File

@ -50,40 +50,10 @@ public:
private:
float re, im;
friend complex& __doapl (complex *, const complex&);
friend complex& __doami (complex *, const complex&);
friend complex& __doaml (complex *, const complex&);
friend complex& __doadv (complex *, const complex&);
// These functions are specified as friends for purposes of name injection;
// they do not actually reference private members.
friend float real (const complex& x) { return x.real (); }
friend float imag (const complex& x) { return x.imag (); }
friend complex operator + (const complex&, const complex&) __attribute__ ((const));
friend complex operator + (const complex&, float) __attribute__ ((const));
friend complex operator + (float, const complex&) __attribute__ ((const));
friend complex operator - (const complex&, const complex&) __attribute__ ((const));
friend complex operator - (const complex&, float) __attribute__ ((const));
friend complex operator - (float, const complex&) __attribute__ ((const));
friend complex operator * (const complex&, const complex&) __attribute__ ((const));
friend complex operator * (const complex&, float) __attribute__ ((const));
friend complex operator * (float, const complex&) __attribute__ ((const));
friend complex operator / (const complex&, const complex&) __attribute__ ((const));
friend complex operator / (const complex&, float) __attribute__ ((const));
friend complex operator / (float, const complex&) __attribute__ ((const));
friend bool operator == (const complex&, const complex&) __attribute__ ((const));
friend bool operator == (const complex&, float) __attribute__ ((const));
friend bool operator == (float, const complex&) __attribute__ ((const));
friend bool operator != (const complex&, const complex&) __attribute__ ((const));
friend bool operator != (const complex&, float) __attribute__ ((const));
friend bool operator != (float, const complex&) __attribute__ ((const));
friend complex polar (float, float) __attribute__ ((const));
friend complex pow (const complex&, const complex&) __attribute__ ((const));
friend complex pow (const complex&, float) __attribute__ ((const));
friend complex pow (const complex&, int) __attribute__ ((const));
friend complex pow (float, const complex&) __attribute__ ((const));
friend istream& operator>> (istream&, complex&);
friend ostream& operator<< (ostream&, const complex&);
friend complex& __doapl<> (complex *, const complex&);
friend complex& __doami<> (complex *, const complex&);
friend complex& __doaml<> (complex *, const complex&);
friend complex& __doadv<> (complex *, const complex&);
};
} // extern "C++"

View File

@ -50,40 +50,10 @@ public:
private:
long double re, im;
friend complex& __doapl (complex *, const complex&);
friend complex& __doami (complex *, const complex&);
friend complex& __doaml (complex *, const complex&);
friend complex& __doadv (complex *, const complex&);
// These functions are specified as friends for purposes of name injection;
// they do not actually reference private members.
friend long double real (const complex& x) { return x.real (); }
friend long double imag (const complex& x) { return x.imag (); }
friend complex operator + (const complex&, const complex&) __attribute__ ((const));
friend complex operator + (const complex&, long double) __attribute__ ((const));
friend complex operator + (long double, const complex&) __attribute__ ((const));
friend complex operator - (const complex&, const complex&) __attribute__ ((const));
friend complex operator - (const complex&, long double) __attribute__ ((const));
friend complex operator - (long double, const complex&) __attribute__ ((const));
friend complex operator * (const complex&, const complex&) __attribute__ ((const));
friend complex operator * (const complex&, long double) __attribute__ ((const));
friend complex operator * (long double, const complex&) __attribute__ ((const));
friend complex operator / (const complex&, const complex&) __attribute__ ((const));
friend complex operator / (const complex&, long double) __attribute__ ((const));
friend complex operator / (long double, const complex&) __attribute__ ((const));
friend bool operator == (const complex&, const complex&) __attribute__ ((const));
friend bool operator == (const complex&, long double) __attribute__ ((const));
friend bool operator == (long double, const complex&) __attribute__ ((const));
friend bool operator != (const complex&, const complex&) __attribute__ ((const));
friend bool operator != (const complex&, long double) __attribute__ ((const));
friend bool operator != (long double, const complex&) __attribute__ ((const));
friend complex polar (long double, long double) __attribute__ ((const));
friend complex pow (const complex&, const complex&) __attribute__ ((const));
friend complex pow (const complex&, long double) __attribute__ ((const));
friend complex pow (const complex&, int) __attribute__ ((const));
friend complex pow (long double, const complex&) __attribute__ ((const));
friend istream& operator>> (istream&, complex&);
friend ostream& operator<< (ostream&, const complex&);
friend complex& __doapl<> (complex *, const complex&);
friend complex& __doami<> (complex *, const complex&);
friend complex& __doaml<> (complex *, const complex&);
friend complex& __doadv<> (complex *, const complex&);
};
inline complex<float>::complex (const complex<long double>& r)

View File

@ -5,6 +5,7 @@ A string initialized to (previous string, 1, 2):el
A string initialized to @:@
A string initialized to 20:20
n = 20 atoi(n) = 20 atof(n) = 20
is = Hello
z = x + y = Helloworld
x += y; x = Helloworld
y.insert (0, x); y = Helloworld
@ -15,6 +16,7 @@ ch = x[0] = H
z = x.substr (2, 3) = llo
x.replace (2, 2, r); x = Hero
x.replace (0, 1, 'j'); x = jello
x = jeHelloo
enter a word:word =abcdefghijklmnopqrstuvwxyz length = 26
End of test