3 ms·
It's strange, though. He includes stdlib.h, and according to my man pages: NAME strtod, strtof, strtold - convert ASCII string to floating-point num
by jrockway 17y ago
It's strange, though. He includes stdlib.h, and according to my man pages:
NAME
strtod, strtof, strtold - convert ASCII string to floating-point number
SYNOPSIS
#include <stdlib.h>
double strtod(const char *nptr, char **endptr);
float strtof(const char *nptr, char **endptr);
Furthermore, here's stdlib.h:
extern float strtof (__const char *__restrict __nptr,
char **__restrict __endptr) __THROW __nonnull ((1)) __wur;
Perhaps it works on my machine because I'm not using an out-of-date version of GCC (gcc (Debian 4.4.4-2) 4.4.4)?
- jey 17y agoScroll down in your manpage to the "CONFORMS TO" section. You'll see that strtof was only introduced in C99. This means that stdlib.h tests some macro to determine whether it's in C99 mode before declaring the prototype for strtof.
- bobbyi 17y agoGCC doesn't use C99 mode by default? Is it going to become the default at some point?
- RiderOfGiraffes 17y agoTo be fair, recent versions probably do. For reasons I won't (or can't) go into, I have a tendency to be using slightly older systems. That's why I'm more interested in finding out how things can be traced, rather than worrying about this specific mis-match between my expectations and the system's behavior.
- jmillikin 17y agoIf it does, that version will break a huge amount of existing C code.