3 ms·
> If the language spec is such that operator -> can’t have a sensible signature, (...) The language spec has zero to do with this. You're commenting on a discu
by simplotek 4y ago
> If the language spec is such that operator -> can’t have a sensible signature, (...)
The language spec has zero to do with this. You're commenting on a discussion on static code analyzers. The specific gotcha you're commenting on mentions that the overloaded operator -> from smart pointers returns a raw pointer to the object being managed, which apparently causes static code analyzers to lose context (it's a raw pointer). The gotcha just mentions a way to help out static code analyzers to not lose context. There's nothing wrong with the spec. At most there's a tip to help out current static code analyzers keep track of semantics.
The worst part of people criticizing C++ is that 9 times out of 10 they base their criticism on ignorance or misconceptions.
- amluto 4y agoThe OP is literally a proposal to standardize modern and “safer” programming guidelines. The chain of logic comes from “Use lvalue references”, which claims that pointer are obsolete and programmers can avoid using them in most cases, other than narrow exceptions for strings, function pointers and such. But it proposes requiring a poor practice of avoiding operator ->. There are two obvious solutions here: either improve the proposal to make an exception for -> or improve the language so that -> is friendlier for static analyzers.