This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strtof is not defined anymore in std=c++11


On Apr  2 12:37, Laurent Alfonsi wrote:
>     Hello,
> 
> The strtof function is now rejected when selecting the gcc C++11
> standard option.
> This regression has been introduced in this patch
>     http://sourceware.org/ml/newlib/2012/msg00425.html
> 
> J.Turney patch is fine regarding the C standard side, but when using
> from C++ :
>     $ cat a.cpp
>     #include <cstdlib>
> 
>     float  f(const char *s, char **endptr) {
>       return strtof(s, endptr);
>     }
> 
> It fails with the message :
>     $ g++ -std=c++11 a.cpp
>     a.cpp: In function 'float f(const char*, char**)':
>     a.cpp:3:30: error: 'strtof' was not declared in this scope
> 
> Whereas this function strtof is well included in the cstdlib header
> file defined in C++11 ISO.
> 
> Please advice.

Not sure.  Enabling c++11 implies defining __STRICT_ANSI__ with gcc.
Maybe we have to add something like this to the #if's guarding the
declarations:

  || (defined (__cplusplus) && __cplusplus >= 201103L)

Jon?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]