[cfe-dev] More extensive unused variable checks

Sean Silva silvas at purdue.edu
Tue Apr 16 16:27:33 PDT 2013


On Tue, Apr 16, 2013 at 2:32 PM, Daniel B Mosesson
<dmosess1 at binghamton.edu>wrote:

> Not really. Const does not enforce no I/O and no modification of
> pointer targets.


For types used in conjunction with the standard library, C++11 actually
puts pretty stringent requirements on what a const function can do.
Basically any function marked const that is used in conjunction with the
standard library must be thread-safe (or else you get undefined behavior).
The const member function in your example can easily be seen to race in a
multithreaded context.

See this for more info:
http://channel9.msdn.com/posts/C-and-Beyond-2012-Herb-Sutter-You-dont-know-blank-and-blank

So const may be strong enough for your analyses under the new rules.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130416/4078e68c/attachment.html>


More information about the cfe-dev mailing list