[cfe-dev] Warning for static member accessed through dot or arrow
Mat Sutcliffe via cfe-dev
cfe-dev at lists.llvm.org
Tue Dec 13 11:19:35 PST 2016
On 12 December 2016 at 08:57, Csaba Raduly <rcsaba at gmail.com> wrote:
> On Mon, Dec 12, 2016 at 1:32 AM, Mat Sutcliffe via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
> > Coincidentally, this came up on StackOverflow just the other day:
> > <http://stackoverflow.com/q/41018973/1639256>
>
> The fact that it caused somebody to go WTF when reading that code
> suggests that a compiler warning about it *is* worthwhile.
>
> That line of code probably caused a loss of 30-60 minutes of
> programmer productivity.
>
Playing devil's advocate against my own proposal for a moment, one /could/
argue that that example is a special case that is particularly confusing
because the member access of a static member is enabling a variable to be
referenced in its own initializer, and is therefore more deserving of a
warning than the general case.
Having said that, I do think it supports my general position that member
access of a static member is an obfuscation in any case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161213/cbf636b4/attachment.html>
More information about the cfe-dev
mailing list