stdio.h patches for g++ -std=c++11

Corinna Vinschen vinschen@redhat.com
Fri May 9 14:26:00 GMT 2014


On May  9 12:15, zosrothko wrote:
> >On 09/05/14 11:01, zosrothko wrote:
> >>Corinna
> >>Le 09/05/2014 10:43, Corinna Vinschen a écrit :
> >>>Is defining them with only
> >>>
> >>>    #if !defined(__STRICT_ANSI__)
> >>>
> >>>sufficient?
> >>That won't work because of this
> >>
> >>$ g++ -xc++ -std=c++11 -dM -E - < /dev/null | sort | grep ANSI
> >>#define __STRICT_ANSI__ 1
> >>
> >>$ g++ -xc++ -std=gnu++11 -dM -E - < /dev/null | sort | grep ANSI
> >>
> >>$
> >>
> >>
> >>g++ with -std=gnu++11 does not define __STRICT_ANSI__ while g++ -std=c++11 does and those previous printfs functions and only those should be defined for c++11. The other traditional stdio functions should be defined only for g++11 and for traditional C.
> >>
> >>People that does not care about compliance will use the gnu++11 version while those that cares about compliance must use the c++11 version and so should be aligned the printfs series from stdio.h
> >>
> >>
> >>Here at http://www.cplusplus.com/reference/clibrary/ is described which functions borrowed from C are included in the new c++11 standard. I worked for now only on the stdio.h functions but all includes should be checked against the strict compliance for c++11.
> >>zos
> >>
> >>
> >GNU++11 is C++11 with extensions.  I don't see a problem with having the
> >i functions in that case.
> There is no problem for having the i functions for gnu++11... but not for
> c++11
> 
> Just to emphase on the compliance for c++11: snprintf is part of the c++11
> standard while fprintf, fscanf, printf, scanf, sprintf are not..

fprintf, fscanf, etc. are defined in C++11.  The declaration block we're
talking about defines only standard functions which are in C++11, or
functions which are newlib-only 'i' variations of the printf/scanf
families.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20140509/e48b7463/attachment.sig>


More information about the Newlib mailing list