0 or 0L for empty pointers?

Michael Pyne michael.pyne at kdemail.net
Tue Jun 20 21:26:10 BST 2006


On Tuesday 20 June 2006 14:10, Friedrich W. H. Kossebau wrote:
> As null pointers are often used as default values in the api docs it might
> make sense to standardise the usage there, no?
>
> I personally preferred 0L, but meanwhile got used to 0 as well. So no wish
> from my side, besides a standard :)

Well AFAIK the standard null pointer in C++ is simply 0 (but it may not work 
with variadic functions, I had that issue in JuK interfacing with glib).

I hear they might introduce an explicit null_ptr which would (in theory) solve 
this whole issue.

I would say that what we currently have (no policy, but rather clarification 
of the issues) is acceptable as long as what we are saying in the 
documentation remains accurate.

The page you linked to says that 0L was used because it was handled correctly 
in variadic functions, but that the issue is an artifact.  It wasn't an 
artifact in my case just recently though, so perhaps it would be better to 
clarify the documentation to make clear that if variadic functions expect a 
NULL pointer as a terminatior, that you should use NULL or static_cast 0 to a 
pointer type or something.

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060620/b795f3f9/attachment.sig>


More information about the kde-core-devel mailing list