"= 0" instead of "= nullptr"?


#1

Hi Jules,

I spotted something out of the ordinary in the FileChooser header file: you are defaulting pointer-based parameters to 0, instead of nullptr! :shock:


#2

http://channel9.msdn.com/shows/Going+Deep/Stephan-T-Lavavej-Everything-you-ever-wanted-to-know-about-nullptr/

As you can see by the interview… The compiler will honor both. (As I update my older code though I have been using nullptr)

Rail


#3

Indeed, I’ve aware of that :smiley: Just pointing it’s out of the ordinary for the library. (See the coding standard)


#4

Aah… I over-reacted to the :shock:

Cheers,

Rail


#5

Ah, thanks for spotting that!


#6

Hey Jules,

Somewhat related to the post’s title, I noticed that there’s some documentation that says @returns [something], or 0 […]” for methods that return a pointer… For clarity, would it be better to say @returns [something], or null […]” (or nullptr… there seems to be a mixture of both null and nullptr in documentation of other functions/methods/classes)?

Examples:

File::createInputStream();

File::createOutputStream();

There are a bunch more… find-replace “or 0” with ‘whatever’ would probably do it.


#7

Ah, you’re clearly as pedantic as I am! Thanks!


#8

The more I code, the more I think I’m suffering from some code-only form of O.C.D.!


#9

Yep. And it only gets worse, in my experience!


#10

BTW, have Jules ever been interviewed? Is there any testimony of it on internet?


#11

Check out this reddit article

Was hoping to find a tedTalk of Jules, or something on programming or C++; I guess I was hoping for too much :smiley: