I think we should remove the method nsAString::AssignLiteral(const char
(&aStr)[N]) because its name is misleading.

The method name AssignLiteral can easily make people at the callee side
think it makes the string point to a piece of static data, which has no
runtime penalty. But this is false.

The fact is that, this method simply calls AssignASCII, which does a
runtime conversion of the whole string, and stores the result dynamically.

Hence I think we should remove this method. All callees should use either
AssignLiteral(MOZ_UTF16("some string")), or, if don't want to bloat the
binary, explicitly use AssignASCII("some string").

(Maybe it will be eaiser to do so after we update the compiler requirement
to VS2015, because since then, we can use u"" instead of MOZ_UTF16(). )

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

Reply via email to