[Development] RFF: nullptr rules
Joerg Bornemann
joerg.bornemann at theqtcompany.com
Thu Dec 10 17:42:30 CET 2015
On 10-Dec-15 17:23, Sergio Martins wrote:
>>> - in some situations, it makes code easier to understand (:
>>> m_foo(nullptr)).
>> So nullptr is easier to understand, because assigning 0 to a pointer
>> variable didn't make clear that it now contains a null pointer?
>> If there's need to signify using m_foo(nullptr) that m_foo is a pointer,
>> then m_foo is maybe a bad name and should be fixed.
>
> : m_foo(0)
>
> What if m_foo was a bool, would you rename the variable or use false instead
> of 0 ?
Nowadays, that bool is a native type, I would of course use the keyword
false, because the type bool takes the values true or false. Anything
else would be an implicit conversion, unlike in pointer assignments.
BR,
Joerg
More information about the Development
mailing list