[PATCH] Fix hpux10 string to real conversion defficiences

FX Coudert fxcoudert@gmail.com
Sat Apr 12 03:36:00 GMT 2008


> I don't believe the code is dead.  It is used for all conversions  
> except
> "nan", "inf" and "infinity".

Of course. I apologise, I read too fast.

> I'll make the other changes.  I thought __attribute__((unused)) had
> to appear on a function's declaration, but I'll recheck.

Indeed, that would be a very good reason to have a forward declaration.

> It is my understanding that that leading whitespace has been stripped
> already.

I think so, because otherwise, we would already have trouble across  
platforms in these cases, but I think Jerry, who knows this code very  
well, could enlighten us with a definite answer.

> The optional stuff is not supported on hpux11, and it is  
> implementation
> dependent on linux.

#include <stdlib.h>
#include <stdio.h>
int main (void) {
   printf ("%lg\n", strtod ("Nanomaterial", NULL));
   printf ("%lg\n", strtod ("Nano structure", NULL));
   printf ("%lg\n", strtod ("infinity is long", NULL));
   printf ("%lg\n", strtod ("inferior quality", NULL));
   return 0;
}

The above gives "nan", "nan", "inf" and "inf" the few targets I have  
tried (including linux and Mac OS). But, as you say, it's not garanteed.

FX


-- 
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/



More information about the Fortran mailing list