Mail Archives: djgpp-workers/2003/06/20/09:35:02
According to Andrew Cottrell:
> All,
>
> Before I submit patches for the files I have changed (and before I finish
> making all of the changes) I would like to find out if the changes are
> potentially acceptable. Below is a diff for strtod.c so it will build with
> GCC 3.3 as an example of the type of changes that I may need to make to a
> number of files.
>
> Is this type of change okay? If not, any info on pointing me in the right
> direction would be gratfully appreciated.
>
> If all goes well I should be able to work on this for allot of tomorrow in
> order to do a second attempt at a set of patches for the source code in
> order to get GCC 3.3 to be able to build the LIBC source with some makefile
> changes for C++ files. Once I do the source patches I will have another look
> at the C++ makefile changes.
>
> diff -u -w -b -i -r1.7 strtod.c
> --- strtod.c 25 May 2003 19:03:43 -0000 1.7
> +++ strtod.c 20 Jun 2003 09:48:04 -0000
> @@ -73,12 +73,17 @@
> /* Handle NAN and NAN(<whatever>). */
> if ( ! strnicmp( "NAN", s, 3 ) )
> {
> - double tmp_d = NAN;
> - double_t n = *(double_t *)(&tmp_d);
> + union a_union
> + {
> + double tmp_d ;
> + double_t n;
> + } t;
The basic idea is a step in the right direction. However I suggest you
make the union public with a sensible name in ieee.h. This will
(hopefully) make us use one type defined once and not a pletora of
different ones.
If you choose not to do the renaming of double_t below, it would be a
great help if it's defined in one place for the time when we _will_
rename double_t.
Then there's the matter that float_t and double_t must be renamed as
they clashes with C99.
Perhaps _float_t and _double_t? Something like:
typedef union
{
double d;
struct
{
unsigned mantissal:32;
unsigned mantissah:20;
unsigned exponent:11;
unsigned sign:1;
} bits; /* Or n. */
} _double_t;
or
typedef struct
{
unsigned mantissal:32;
unsigned mantissah:20;
unsigned exponent:11;
unsigned sign:1;
} _double_t;
typedef union
{
double d;
_double_t n; /* Or bits. */
} _double_union_t;
It makes sense to clean out this C99 incompatibility if you're going
to mess with the use of double_t anyway.
Right,
MartinS
- Raw text -