[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#286659: libc6-dev: strtof does not work, strtod works



On Tuesday, December 21, 2004 10:53 AM, Igor Pesando <ipesando@to.infn.it>
wrote:

strtof() works fine, you've just missed a key note at the foot of strtof(3):

CONFORMING TO
       ANSI C describes strtod, C99 describes the other two functions.

By default, gcc will use `gnu89' (ISO C90 plus some GNU extensions) as the
standard to compile against (see gcc(1)). Those extensions *don't* include
strtof() or strtold().

> Try to run
[...]

Compiling the provided sample with saner flags should have highlighted the
fact that there was an issue:

adam@kaa:~$ gcc -Wall -o 286659 286659.c
286659.c: In function `main':
286659.c:14: warning: implicit declaration of function `strtof'

At this point, examining stdlib.h will show that the definition of strtof is
wrapped in a `#ifdef  __USE_ISOC99'. So...

adam@kaa:~$ gcc -Wall -std=c99 -o 286659 286659.c
adam@kaa:~$ ./286659
S0=12.300000
S1=12.300000

IMHO, this bug should be closed as due to user error.

Regards,

Adam




Reply to: