[cfe-dev] More extensive unused variable checks

Daniel B Mosesson dmosess1 at binghamton.edu
Tue Apr 16 11:32:19 PDT 2013

Not really. Const does not enforce no I/O and no modification of
pointer targets. Here is an example:

struct test1
	int* a;
	test1(int* b){a = b;}
	void mod() const
int main()
	int q = 2;
	test1 b(&q);
	return 0;

That is why I believe that attributes will probably be necessary to
solve this issue, though if there is a better way, I would be all for

On 4/16/13, Sean Silva <silvas at purdue.edu> wrote:
> On Tue, Apr 16, 2013 at 9:43 AM, Daniel B Mosesson
> <dmosess1 at binghamton.edu>wrote:
>> I was thinking about an set of attributes for STL containers (just to
>> make this manageable) that would identify the operations for the
>> container classes as either read or write (or both, as in the case of
>> indexers).
>> Is there a reason not to use attributes for this purpose?
> What about member functions being marked as `const`? Would that be
> sufficient indication?
> -- Sean Silva

More information about the cfe-dev mailing list