L. David Baron wrote:

const PRUnichar *comma = MOZ_UTF16(",");
In the case addressed by the referenced bug, the string was used in a call to Append, which meant that this is still inefficient. The patch in the bug fixed this by switching to appending a character rather than a string.

If you do need to append a wide string rather than a character you have the choice of s.Append(NS_LITERAL_STRING("stuff")) or s.AppendLiteral("stuff"), both of which measure the length of the string at compile time, unlike s.Append(MOZ_UTF16("stuff")) which measures it at run time. As of bug 514173 I hope to make s.AppendLiteral(MOZ_UTF16("stuff")) work too. (I can't overload Append because I can't guarantee that you're really passing a literal.)

--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to