Re: C++ Headers

From: ncm(at)zembu(dot)com (Nathan Myers)
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: C++ Headers
Date: 2001-05-23 01:27:19
Message-ID: 20010522182719.I18121@store.zembu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 22, 2001 at 05:52:20PM -0400, Bruce Momjian wrote:
> > On Tue, May 22, 2001 at 12:19:41AM -0400, Bruce Momjian wrote:
> > > > This in fact has happened within ECPG. But since sizeof(bool) is
> > > > passed to libecpg it was possible to figure out which 'bool' is
> > > > requested.
> > > >
> > > > Another issue of C++ compatibility would be cleaning up the
> > > > usage of 'const' declarations. C++ is really strict about
> > > > 'const'ness. But I don't know whether postgres' internal headers
> > > > would need such a cleanup. (I suspect that in ecpg there is an
> > > > oddity left with respect to host variable declaration. I'll
> > > > check that later)
> > >
> > > We have added more const-ness to libpq++ for 7.2.
> >
> > Breaking link compatibility without bumping the major version number
> > on the library seems to me serious no-no.
> >
> > To const-ify member functions without breaking link compatibility,
> > you have to add another, overloaded member that is const, and turn
> > the non-const function into a wrapper. For example:
> >
> > void Foo::bar() { ... } // existing interface
> >
> > becomes
> >
> > void Foo::bar() { ((const Foo*)this)->bar(); }
> > void Foo::bar() const { ... }
>
> Thanks. That was my problem, not knowing when I break link compatiblity
> in C++. Major updated.

Wouldn't it be better to add the forwarding function and keep
the same major number? It's quite disruptive to change the
major number for what are really very minor changes. Otherwise
you accumulate lots of near-copies of almost-identical libraries
to be able to run old binaries.

A major-number bump should usually be something planned for
and scheduled.

Nathan Myers
ncm(at)zembu(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-05-23 01:52:03 RE: DROP CONSTRAINT patch
Previous Message Tatsuo Ishii 2001-05-23 00:59:57