From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Buck To: martin@mira.isdn.cs.tu-berlin.de (Martin von Loewis) Cc: jbuck@synopsys.com, law@cygnus.com, rittle@comm.mot.com, egcs@cygnus.com Subject: Re: Implications of tighter integration of libg++ Date: Mon, 09 Feb 1998 21:34:00 -0000 Message-id: <199802092347.PAA19098@atrus.synopsys.com> References: <199802092327.AAA04763@mira.isdn.cs.tu-berlin.de> X-SW-Source: 1998-02/msg00402.html I wrote: > > say "using namespace std;" as that imports all names. Rather, just > > things like > > > > using std::istream; > > using std::ostream; > > using std::cin; > > using std::cout; > > using std::cerr; Martin von Loewis writes: > This does not solve the problem I'm talking about. With that scheme, > and the implementation of namespace I have in mind, names would still > come out as Q23std7istream, rather than 7istream as they do now. This > is because the compiler would always resolve names to the place where > they are actually introduced, regardless of any using and typedef > magic applied. > > So, even if old sources would still compile, old objects would not > link anymore. This is especially bad in presence of shared libraries > which have to accomodate both sets of header files. If the only issue were that library functions and data definitions move into std, we could solve it in the linker: GNU ld would get a list of names to be remapped, and it would make old programs link by means of name remapping for identifiers that would otherwise be undefined. Unfortunately, iostreams needs to get a much bigger rewrite: not only do istream and ostream move into std, but they are really basic_istream and basic_ostream. A number of access functions change as well. Even so, perhaps a backward compatibility layer could be written. But it might be easier just to ship two libstdc++ versions with different major version numbers than to try to figure out how to make one library do. The whole reason for using the std namespace is so that users are freed up to use the hundreds of names the standard library takes away. Any scheme that tries to preserve backward compatibility will also pollute the namespace (preventing users from using certain identifier names), meaning that we won't have a conforming compiler. For that reason I think that the solution to binary compatibility is to just bump the major version number on the shared library. Users who must run old binaries will need the old shared library, but the two versions can co-exist on the same system.