LWN.net Logo

LCA: Static analysis with GCC plugins

LCA: Static analysis with GCC plugins

Posted Jan 23, 2010 23:04 UTC (Sat) by ikm (subscriber, #493)
In reply to: LCA: Static analysis with GCC plugins by tialaramex
Parent article: LCA: Static analysis with GCC plugins

> So you're left with things that might be correct, but probably aren't.

C++ is naturally quite context-dependent. And shadowing in it is quite useful -- you don't need to come up with some crazy variable names just because all the saner ones are already used. I shadow stuff all the time and it never really backfired. And I do enjoy nice, concise, context-dependent names. So I don't share the "probably aren't" part.


(Log in to post comments)

LCA: Static analysis with GCC plugins

Posted Jan 25, 2010 10:34 UTC (Mon) by epa (subscriber, #39769) [Link]

I guess the tool could give you a warning for the unintentional cases, and when you really do want to shadow a class member you can flag it with some new keyword or magic comment:

int x; /* shadow */

LCA: Static analysis with GCC plugins

Posted Feb 4, 2010 12:09 UTC (Thu) by adobriyan (guest, #30858) [Link]

> int x; /* shadow */

Don't overload comments.

#ifdef __CHECKER__
#define __shadow ...
#else
#define __shadow
#endif

int __shadow x;

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds