Op 8-10-2015 om 11:27 schreef René J.V. Bertin:
> Hi,
>
> A bit of a generic question, for my personal education. I saw a comment in a 
> code review recently (one related to making Qt build on OS X 10.11, probably) 
> about the preferred use of 0 instead of NULL.
>
> I didn't realise at first why that remark surprised me somewhere. Now I 
> remembered having to modify some of my own code to use NULL instead of 0 to 
> avoid crashing, on 64bit (capable) hardware. I cannot remember the exact 
> details other than that I ended up with undefined (= possibly non zero) bits 
> in the more significant 32 bit word, and that at least some of the functions 
> involved used va_arg. I can also remember slapping my forehead for having 
> been too lazy to type a few extra characters...
>
> Is it certain that there are no pitfalls that come with trusting the compiler 
> to do the proper conversions, on all platforms where Qt is supposed to work? 
> Did I simply hit a "feature" Qt won't ever encounter because it doesn't use C 
> (nor va_arg)?
>
> R.
> _______________________________________________
> Development mailing list
> Development@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
Nowadays, for code that you won't need to compile with non C++/11 
complient compilers, I'd recommend to use nullptr instead. At least, 
nullptr will always be interpretted as a pointer.

André


_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to