linux libio status

Joe Buck jbuck@synopsys.com
Wed Oct 15 20:16:00 GMT 1997


> > I worked around this for Linux/Alpha by providing versions of 
> > libc-lock.h and stdio-lock.h to install with the newly built library.
> > Perhaps we do the same thing for Intel?
> 
> I worked around this by copying egcs-971009/libio/libio.h into
> /usr/include/g++.

I don't believe that this is safe to do in general.  If you're using the
5.3.12 libio you need the matching header.  The problem is that some
structures have changed; this may be the cause of your crashes described
below.

> By the way strstream seems to be broken if you let it dynamically allocate
> it's own buffer.  The following program gives a segmentation fault:
> 
> #include <cstdlib>
> #include <string>
> #include <strstream.h>
> main()
> {
>   ostrstream os;
>   os << "testing " << 123 << ends;
>   string s = os.str();
>   exit(0);
> }

The fault doesn't occur on Solaris; it may be a libio issue (possibly
tweaked by your use of the wrong libio).

> This one used to work for me under gcc-2.7.2.1 but is also broken with egcs:
> 
> #include <cstdlib>
> #include <string>
> #include <strstream.h>
> main()
> {
>   char buf[100]
>   ostrstream os(buf, 100);
>   os << "testing " << 123 << ends;
>   string s = os.str();
>   exit(0);
> }

Again, once I put in the missing semicolon I have no problem on Solaris.



More information about the Gcc mailing list