This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: Two small patches
- To: Alfred Minarik <a8601248@unet.univie.ac.at>
- Subject: Re: Two small patches
- From: Gabriel Dos_Reis <Gabriel.Dos_Reis@sophia.inria.fr>
- Date: 05 Jun 1999 17:49:46 +0200
- Cc: libstdc++_list <libstdc++@sourceware.cygnus.com>
- Organization: I.N.R.I.A Sophia-Antipolis (France)
- References: <37590D6C.3E0449D2@unet.univie.ac.at>
Alfred Minarik <a8601248@unet.univie.ac.at> writes:
| While compiling the 19990604 cvs sources with
| -fnew-abi -fhonor-std I came across two small problems:
|
| a) The compilation fails in bits/std_cmath.h as the compiler
| cannot call ::modf(__x, __y) with __y being a float.
| The prototype of ::modf is 'double modf(double x, double *iptr)'
| So you want also not define 'float modf(float,float)'
| but 'float modf(float,float*)'.
Yep :-( It turns out that I should have slept those days I made
the change.
| Here is my proposal:
|
| Index: bits/std_cmath.h
| ===================================================================
| RCS file: /cvs/libstdc++/libstdc++/bits/std_cmath.h,v
| retrieving revision 1.8
| diff -c -3 -r1.8 std_cmath.h
| *** std_cmath.h 1999/06/02 18:41:57 1.8
| --- std_cmath.h 1999/06/05 11:27:51
| ***************
| *** 95,101 ****
| log10(float __x) { return ::log10(__x); }
|
| inline float
| ! modf(float __x, float __y) { return ::modf(__x, __y); }
|
| inline float
| pow(float __x, float __y) { return ::pow(__x, __y); }
| --- 95,107 ----
| log10(float __x) { return ::log10(__x); }
|
| inline float
| ! modf(float __x, float* __y)
| ! {
| ! double __tmp;
| ! double __ret = ::modf(__x, &__tmp);
| ! *__y = __tmp;
| ! return __ret;
| ! }
In fact, the 'correct' fix is
inline float
modf(float __x, float* __y) { return ::modff(__x, __y); }
that is I should have written ::modff(); not ::modf().
Thanks.
[...]
|
| b) Linking with the new library gives two "undefined reference"
| errors: __out_of_range(char const *)
| and __length_error(char const *).
|
| The solution is to put the declaration of
| extern void __out_of_range (const char *__str);
| extern void __length_error (const char *__str);
| in bits/basic_string.h into namespace std
| as it is done in bits/utility.h:
I leave this to Benjamin.
-- Gaby