Re: C++ Headers - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: C++ Headers
Date
Msg-id 200105222152.f4MLqKW19017@candle.pha.pa.us
Whole thread Raw
In response to Re: C++ Headers  (ncm@zembu.com (Nathan Myers))
Responses Re: C++ Headers  (ncm@zembu.com (Nathan Myers))
List pgsql-hackers
> 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.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: "Mikheev, Vadim"
Date:
Subject: RE: Plans for solving the VACUUM problem
Next
From: Bill Studenmund
Date:
Subject: Re: Detecting readline in configure