3 ms·
Misleading headline -- GCC is behaving according to spec. It would have a bug if the output had been 5.7 in both cases. Arguably, allowing procedures to be cal
by jmillikin 16y ago
Misleading headline -- GCC is behaving according to spec. It would have a bug if the output had been 5.7 in both cases.
Arguably, allowing procedures to be called without prototypes is a bug in the C spec, but I doubt it'll be removed any time soon simply due to sheer volume of extant legacy code.
- jrockway 16y agoIt'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 16y 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 16y agoGCC doesn't use C99 mode by default? Is it going to become the default at some point?
- RiderOfGiraffes 16y 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 16y agoIf it does, that version will break a huge amount of existing C code.