[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] vector<Variable*> and vector<const Variable*>

Ideally we should use vector<const Variable*> *unless* we expect the Variable object in the vector to be modified. I remember we have to overload some functions with parameters of both 'vector<Variable*>' type and 'vector<const Variable*>' to please the compilers, e.g., MSVC and g++.

Feel free to remove some of the awkwardness if you can keep the compilers pleased. Maybe they have become smarter over the last few years.


-----Original Message-----
From: csmith-dev-bounces@flux.utah.edu [mailto:csmith-dev-bounces@flux.utah.edu] On Behalf Of Gerlach, Jens
Sent: Tuesday, November 24, 2015 8:07 AM
To: csmith-dev@flux.utah.edu
Subject: [csmith-dev] vector<Variable*> and vector<const Variable*>


I have noticed that both the types 'vector<Variable*>’ and ‘ vector<const Variable*>’ are used a lot in csmith.
There is even at least one function VariableSelector::expand_struct_union_vars that is overloaded based on these two types, but the implementation of the two overloaded versions do exactly the same.

What is the rationale for having both vectors of ‘Variable*' and ‘const Variable*’?