On Tuesday 2012-12-04 10:00 +0000, Neil wrote: > Blake Kaplan wrote: > > >Neil <n...@parkwaycc.co.uk> wrote: > > > >>>static const PRUnichar* kResetBackupDirectory = > >>>NS_LITERAL_STRING("resetBackupDirectory").get(); > >>> > >Isn't this an anti-pattern anyway because the string (and the memory owned > >by it) will get destructed after the semicolon "runs" leaving > >kResetBackupDirectory pointing at deleted memory? > > > Yes, this is why I said it is technically incorrect, but we use a > string literal (L"" or u"") where we can; only on systems that don't > support UTF16 string literals do we allocate memory. If no such > systems remain, we should really switch to > NS_L("resetBackupDirectory") throughout.
But if we want to use NS_L widely, we should first rename it to have a name that looks more like u"" (which is what it does, since it always produces 2-byte characters) than L"". -David -- 𝄞 L. David Baron http://dbaron.org/ 𝄂 𝄢 Mozilla http://www.mozilla.org/ 𝄂 _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform