public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joe Buck <jbuck@synopsys.com>
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	[thread overview]
Message-ID: <199802092347.PAA19098@atrus.synopsys.com> (raw)
In-Reply-To: <199802092327.AAA04763@mira.isdn.cs.tu-berlin.de>

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<char> and basic_ostream<char>.  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.


  reply	other threads:[~1998-02-09 21:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-24 23:19 Loren J. Rittle
1997-11-25  6:52 ` Manfred.Hollstein
1998-02-09  2:22 ` Jeffrey A Law
1998-02-09  7:13   ` Martin von Loewis
1998-02-09 14:46     ` Joe Buck
1998-02-09 15:33       ` Martin von Loewis
1998-02-09 21:34         ` Joe Buck [this message]
1998-02-10  0:53           ` John A. Tamplin
1998-02-10 10:30             ` Joe Buck
1998-02-09 21:34         ` H.J. Lu
1998-02-09 11:54   ` Joe Buck
1998-02-09 14:46     ` H.J. Lu
     [not found] ` <5837.887019874.cygnus.egcs@hurl.cygnus.com>
1998-02-09 11:31   ` Jason Merrill
1998-02-09 11:54     ` Jeffrey A Law
1998-02-09 11:54       ` Jason Merrill
1998-02-09 15:33         ` Fred Fish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199802092347.PAA19098@atrus.synopsys.com \
    --to=jbuck@synopsys.com \
    --cc=egcs@cygnus.com \
    --cc=law@cygnus.com \
    --cc=martin@mira.isdn.cs.tu-berlin.de \
    --cc=rittle@comm.mot.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).