string16

21 views
Skip to first unread message

Thiago Farina

unread,
Apr 28, 2012, 12:23:22 PM4/28/12
to Chromium-dev, bre...@chromium.org
Hey,

I just noticed some usages of ASCIIToUTF16(""). But instead of doing
this, isn't string16() preferred in the first place?

Thanks,

Alexei Svitkine

unread,
Apr 28, 2012, 12:31:17 PM4/28/12
to tfa...@chromium.org, Chromium-dev, bre...@chromium.org
Yes, string16() is preferred. Maybe we should add a lint check for it.

-Alexei

Peter Kasting

unread,
Apr 30, 2012, 2:29:05 PM4/30/12
to asvi...@chromium.org, tfa...@chromium.org, Chromium-dev, bre...@chromium.org
Similarly, std::string() is usually preferred over "", e.g. when passing arguments to a function that takes "const std::string&".  This one isn't quite as silly as ASCIIToUTF16("") but it's also a lot more commonly goofed up.

PK

Thiago Farina

unread,
May 6, 2012, 11:08:43 AM5/6/12
to Chromium-dev, Peter Kasting, asvi...@chromium.org, tfa...@chromium.org, bre...@chromium.org


On Apr 30, 3:29 pm, Peter Kasting <pkas...@chromium.org> wrote:
> On Sat, Apr 28, 2012 at 9:31 AM, Alexei Svitkine <asvi...@chromium.org>wrote:
>
> > On Sat, Apr 28, 2012 at 12:23 PM, Thiago Farina <tfa...@chromium.org>
> > wrote:
> > > Hey,
>
> > > I just noticed some usages of ASCIIToUTF16(""). But instead of doing
> > > this, isn't string16() preferred in the first place?
>
> > Yes, string16() is preferred. Maybe we should add a lint check for it.
>
I have fixed all the entries. Just landed the last patch today.
Looking forward to add the lint check (like we have for wstring).
Reply all
Reply to author
Forward
0 new messages