Keeping binary compatibility

Michael Pyne mpyne at purinchu.net
Wed Oct 6 02:05:48 BST 2010


On Tuesday, October 05, 2010 14:21:58 Lubos Lunak wrote:
> On Tuesday 05 of October 2010, Michael Pyne wrote:
> > On Monday, October 04, 2010 17:55:30 Lubos Lunak wrote:
> > > On Monday 04 of October 2010, George Kiagiadakis wrote:
> > > > I think source compatibility is easier to maintain because it is
> > > > more
> > > > obvious when you break it and people generally understand it
> > > > better
> > > > than binary compatibility. I don't think we have a problem
> > > > keeping
> > > > source compatibility atm, do we?
> > >  
> > >  We occassionally do (I e.g. remember fixing a bug somewhen in the
> > >  past
> > > 
> > > that had been introduced by broken source compatibility and people
> > > thinking 0 is a null pointer).
> > 
> > Are you referring to 0 in C, or in C++? I ask only because 0 really *is*
> > the C++ null pointer (or at least, the only way of convincing the C++
> > compiler to use whatever the actual null pointer is), at least until
> > C++0x's nullptr addition gets better supported.
> > 
> > The catch is that conversion from 0 to "real null pointer" only happens
> > for pointer types, so if int is also possible, C++ is perfectly happy
> > to not perform the conversion.
> 
>  Thanks for saving me the work of refuting your first paragraph by doing so
> in your second paragraph :).

Well my second paragraph explains why what I explained in my first paragraph 
sucks, but it doesn't change any facts in the first paragraph. 

As far as C++ the language is concerned, 0 is as close to the null pointer as 
you're going to get, and to argue otherwise is kind of disingenuous in my 
opinion. Bjarne Stroustrup explains the current status of the C++ null pointer 
in his paper [1] trying to get a null pointer added to C++ that doesn't suck.

The platform hardware or ABI may certainly disagree with the null pointer 
being 0, and that can be important if you're writing clang or GCC but from a 
C++ programmers' point of view, 0 really is the null pointer.

> And note that at least with gcc NULL already
> is nullptr in practice.

That's a good point, and a good reason that most of us should just be 
preferring NULL anyways. I'm already sick of 0's dual hat as pointer and int 
;)

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20101005/4a57cbe9/attachment.sig>


More information about the kde-core-devel mailing list