newlib 1.10.0 vs Linux string.h difference
Joel Sherrill
joel.sherrill@OARcorp.com
Thu Aug 22 14:40:00 GMT 2002
"J. Johnston" wrote:
>
> Eric Norum wrote:
> >
> > On Thursday, August 22, 2002, at 10:57 AM, Joel Sherrill
> > <joel@OARcorp.com> wrote:
> >
> > >
> > > Hi,
> > >
> > > Eric Norum ran across a problem some libstdc++-v3 code in gcc 3.2
> > > which compiles native but doesn't with newlib because of a minor
> > > difference in the two string.h implementations. I don't know whether
> > > this is a bug in newlib or not and wanted comments:
> > >
> > > The file:
> > >
> > > #include <string.h>
> > >
> > > int f(char *c1) {
> > > char *c;
> > > c=strdup(c1);
> > > }
> > >
> >
> > I'd just like to add that the problem shows up in the C++ header
> > bits/locale_facets.tcc which uses strdup. This makes it impossible to
> > compile some otherwise-valid C++ programs with -ansi and the newlib
> > headers.
> >
> > --
>
> The -ansi flag is defined as follows:
>
> `-ansi'
> In C mode, support all ANSI standard C programs. In C++ mode,
> remove GNU extensions that conflict with ISO C++.
>
> Thus, we should be testing for __cplusplus in addition to __STRICT_ANSI__. I would suggest
> that this matter be brought up on the libstdc++ forum to see what, if any, extensions
> newlib should be screening. The tests can be modified to be:
>
> #if !defined(__STRICT_ANSI__) || defined(__cplusplus)
Thanks Jeff. Will do.
I hate to cross post but should this be cross-posted or just cc the
you, Eric, and I?
> -- Jeff J.
More information about the Newlib
mailing list