2 ms·
Right, I believe I now understand more of what's happening. Prior to C99 there was no strtof. Some people may have rolled their own, but it wasn't provided, y
by RiderOfGiraffes 16y ago
Right, I believe I now understand more of what's happening.
Prior to C99 there was no strtof. Some people may have rolled their own, but it wasn't provided, you used strtod and cast to float if that's what you wanted.
Then C99 included strtof, so the code (and hence symbol) became available in the libraries. However, to avoid clashing with legacy code in which someone used their own version, the prototype is only declared if the compiler is in C99 mode.
That means that if you're not in C99 mode, you use the symbol strtof, and you don't declare the function for yourself, the compiler successfully finds the symbol in the library and links to the C99 code, but hasn't declared the prototype, so you don't get what you think you get.
And by default you don't get warned.
To repeat the moral: use -Wall.