[cfe-dev] Warning for static member accessed through dot or arrow

Mat Sutcliffe via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 14 09:50:13 PST 2016


On 14 December 2016 at 03:28, Jared Grubb <jared.grubb at gmail.com> wrote:

> I've written code like this for a long while:
>
> void foo(std::string const& str) {
>   if (str.find("/") != str.npos) {
> ...
>   }
> }
>
> Is this considered weird style? I find "s.npos" much more usable that
> "std::string::npos" and in this one instance I would probably not enable
> your check.
>
> Not to derail the conversation because I might be in the minority on this
> one!!
>
> Jared
>

Not at all a derailment. This is a great counterexample. I would not write
code like this, but this is one of those cases where it can be idiomatic to
some people.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161214/c8702cb1/attachment.html>


More information about the cfe-dev mailing list