On 12-07-30 10:23 AM, Aryeh Gregor wrote:
On Wednesday, July 25, 2012 12:45:52 PM UTC+3, Aryeh Gregor wrote:
The C++11 standard defines a new dedicated null-pointer symbol, "nullptr".  It provides better type-safety than 
existing null-pointer definitions, because it doesn't allow implicit conversion to numeric types.  In 
<https://bugzilla.mozilla.org/show_bug.cgi?id=626472> I defined "nullptr" to mean 0L/0LL (like current 
nsnull) where unsupported, then redefined "nsnull" to mean "nullptr".  This caught a bunch of places 
where people were using nsnull to mean crazy things like NS_OK or other things that happened to equal 0.



The next step is to s/nsnull/nullptr/ in the codebase, and get rid of nsnull.  There's no reason 
for us to use our own identifier when there's a standard one.  This will be of comparable scale to 
the PRBool elimination of last year -- around 20,000 lines changed instead of 30,000.  This will of 
course insta-bitrot any patches that people have that mention "nsnull" anywhere, but a 
shell script will be provided to auto-fix them, as with the PRBool switch (something like "sed 
-i s/\bnsnull\b/nullptr/ .hg/patches{,-*}/*" should do it).



This message is of general interest because after the switch, "nsnull" will no 
longer work, and patch queues will have to be updated.  Also, anyone who maintains a 
branch will want to figure out how to avoid merge pain.

This is now done on m-c:

http://hg.mozilla.org/mozilla-central/rev/b5c4b792f3f2

Ehsan is going to watch the tree and handle the m-i merge.  To un-bitrot your 
Mercurial patches, you can use the script provided here:

Looks like the builds are fairly green on all platforms on both mozilla-central and mozilla-inbound.

Please use nullptr in all new code. We will remove nsnull shortly after this, to give people a little time to adjust to using nullptr.

Cheers,
Ehsan

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to