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

[csmith-dev] [PATCH 3/3] Be a little more consistent with the std namespace.



From: Eitan Adler <lists@eitanadler.com>

It is generally considered a Bad Idea (tm) to have 'using namespace
std;' in c++ code.

The patch replaces all instances of 'using namespace std;' with up to
four 'using std::item;' declarations and adds a 'std::' prefix to the
vast majority of unscoped class uses.

The rest of them can be fixed organically (as the code itself changes)
with the corrosponding using std::??? removed.

Signed-off-by: Eitan Adler <lists@eitanadler.com>

 95 files changed, 627 insertions(+), 400 deletions(-)

diff --git a/src/AbsExtension.cpp b/src/AbsExtension.cpp
index c621d4c..0a960fe 100644
--- a/src/AbsExtension.cpp
+++ b/src/AbsExtension.cpp
@@ -43 +43,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/AbsProgramGenerator.cpp b/src/AbsProgramGenerator.cpp
index 456e9e6..e35ff74 100644
--- a/src/AbsProgramGenerator.cpp
+++ b/src/AbsProgramGenerator.cpp
@@ -39 +39,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -80 +84 @@ AbsProgramGenerator::CreateInstance(int argc, char *argv[], unsigned long seed)
-			cout << "parsing configuration file error:" << msg << endl;
+			std::cout << "parsing configuration file error:" << msg << endl;
diff --git a/src/AbsRndNumGenerator.cpp b/src/AbsRndNumGenerator.cpp
index 79c5574..3e9bcdf 100644
--- a/src/AbsRndNumGenerator.cpp
+++ b/src/AbsRndNumGenerator.cpp
@@ -40 +40,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/ArrayVariable.cpp b/src/ArrayVariable.cpp
index dfb6f7e..dff1910 100644
--- a/src/ArrayVariable.cpp
+++ b/src/ArrayVariable.cpp
@@ -62 +62,5 @@
-using namespace std;  
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+  
@@ -387 +391 @@ ArrayVariable::rnd_mutate(void)
-			ostringstream oss;
+			std::ostringstream oss;
@@ -803 +807 @@ ArrayVariable::hash(std::ostream& out) const
-	ostringstream oss;
+	std::ostringstream oss;
diff --git a/src/ArrayVariable.h b/src/ArrayVariable.h
index 1f60067..05881a7 100644
--- a/src/ArrayVariable.h
+++ b/src/ArrayVariable.h
@@ -41 +40,0 @@ class Block;
-using namespace std;
@@ -69 +68 @@ public:
-	string make_print_index_str(void) const;
+	std::string make_print_index_str(void) const;
@@ -75 +74 @@ public:
-	virtual const ArrayVariable* get_array(string& /*field*/) const { return this;}
+	virtual const ArrayVariable* get_array(std::string& /*field*/) const { return this;}
@@ -79 +78 @@ public:
-	void output_checksum_with_indices(std::ostream &out, const std::vector<const Variable*>& cvs, string field_name) const;
+	void output_checksum_with_indices(std::ostream &out, const std::vector<const Variable*>& cvs, std::string field_name) const;
@@ -81 +80 @@ public:
-	void output_addr_checks(std::ostream &out, const Variable* var, string field_name, int indent) const;
+	void output_addr_checks(std::ostream &out, const Variable* var, std::string field_name, int indent) const;
@@ -84,2 +83,2 @@ public:
-	string build_initializer_str(const vector<string>& init_strings) const;
-	string build_init_recursive(size_t dimen, const vector<string>& init_strings) const;
+	std::string build_initializer_str(const std::vector<std::string>& init_strings) const;
+	std::string build_init_recursive(size_t dimen, const std::vector<std::string>& init_strings) const;
@@ -90 +89 @@ private:
-	ArrayVariable(Block* blk, const std::string &name, const Type *type, const Expression* init, const CVQualifiers* qfer, const vector<unsigned int>& sizes, const Variable* isFieldVarOf);
+	ArrayVariable(Block* blk, const std::string &name, const Type *type, const Expression* init, const CVQualifiers* qfer, const std::vector<unsigned int>& sizes, const Variable* isFieldVarOf);
diff --git a/src/Block.cpp b/src/Block.cpp
index b2abe06..21f60ca 100644
--- a/src/Block.cpp
+++ b/src/Block.cpp
@@ -63 +63,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -638 +642 @@ Block::remove_stmt(const Statement* s)
-	//	s->Output(cout, fm);
+	//	s->Output(std::cout, fm);
diff --git a/src/Bookkeeper.cpp b/src/Bookkeeper.cpp
index c0d367b..ac94575 100644
--- a/src/Bookkeeper.cpp
+++ b/src/Bookkeeper.cpp
@@ -49 +49,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -404 +408 @@ Bookkeeper::record_volatile_access(const Variable* var, int deref_level, bool wr
-				//var->OutputDef(cout);
+				//var->OutputDef(std::cout);
diff --git a/src/Bookkeeper.h b/src/Bookkeeper.h
index 1d94ca6..e68d558 100644
--- a/src/Bookkeeper.h
+++ b/src/Bookkeeper.h
@@ -36 +36,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/CFGEdge.h b/src/CFGEdge.h
index 08d30d3..4dd49af 100644
--- a/src/CFGEdge.h
+++ b/src/CFGEdge.h
@@ -35 +35,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/CGContext.cpp b/src/CGContext.cpp
index a09b4ed..e3fcbf4 100644
--- a/src/CGContext.cpp
+++ b/src/CGContext.cpp
@@ -49 +49,4 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::ostream;
+
@@ -175 +178 @@ CGContext::is_nonwritable(const Variable *v) const
-	map<const Variable*, unsigned int>::const_iterator iter;
+	std::map<const Variable*, unsigned int>::const_iterator iter;
@@ -522 +525 @@ CGContext::output_call_chain(std::ostream &out)
-	out << endl;
+	out << std::endl;
@@ -649 +652 @@ CGContext::get_external_no_reads_writes(VariableSet& no_reads, VariableSet& no_w
-	map<const Variable*, unsigned int>::const_iterator iter;
+	std::map<const Variable*, unsigned int>::const_iterator iter;
diff --git a/src/CGContext.h b/src/CGContext.h
index 6bde9c5..b48c8f6 100644
--- a/src/CGContext.h
+++ b/src/CGContext.h
@@ -38 +38,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
@@ -165 +167 @@ public: // XXX
-	map<const Variable*, unsigned int> iv_bounds;
+	std::map<const Variable*, unsigned int> iv_bounds;
diff --git a/src/CGOptions.cpp b/src/CGOptions.cpp
index d4fe753..9745129 100644
--- a/src/CGOptions.cpp
+++ b/src/CGOptions.cpp
@@ -46 +46,4 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::ostream;
+
@@ -271 +274 @@ CGOptions::set_platform_specific_options(void)
-	ifstream conf(PLATFORM_CONFIG_FILE);
+	std::ifstream conf(PLATFORM_CONFIG_FILE);
@@ -273,3 +276,3 @@ CGOptions::set_platform_specific_options(void)
-		ofstream conf(PLATFORM_CONFIG_FILE);
-		conf << int_str << sizeof(int) << endl;
-		conf << ptr_str << sizeof(int*) << endl;
+		std::ofstream conf(PLATFORM_CONFIG_FILE);
+		conf << int_str << sizeof(int) << std::endl;
+		conf << ptr_str << sizeof(int*) << std::endl;
@@ -296 +299 @@ CGOptions::set_platform_specific_options(void)
-			cout << "please specify integer size in " << PLATFORM_CONFIG_FILE << endl;
+			std::cout << "please specify integer size in " << PLATFORM_CONFIG_FILE << std::endl;
@@ -300 +303 @@ CGOptions::set_platform_specific_options(void)
-			cout << "please specify pointer size in " << PLATFORM_CONFIG_FILE << endl;
+			std::cout << "please specify pointer size in " << PLATFORM_CONFIG_FILE << std::endl;
diff --git a/src/CGOptions.h b/src/CGOptions.h
index 1f947d3..9209ca1 100644
--- a/src/CGOptions.h
+++ b/src/CGOptions.h
@@ -36 +36,2 @@
-using namespace std;
+using std::vector;
+using std::string;
diff --git a/src/CVQualifiers.cpp b/src/CVQualifiers.cpp
index cb481da..76c116a 100644
--- a/src/CVQualifiers.cpp
+++ b/src/CVQualifiers.cpp
@@ -622 +622 @@ CVQualifiers::is_volatile_after_deref(int deref_level) const
-		cout << "len = " << len << ", deref_level = " << deref_level << std::endl;
+		std::cout << "len = " << len << ", deref_level = " << deref_level << std::endl;
@@ -706 +706 @@ CVQualifiers::output() const
-		cout << is_consts[i] << " ";
+		std::cout << is_consts[i] << " ";
@@ -708 +708 @@ CVQualifiers::output() const
-	cout << ", ";
+	std::cout << ", ";
@@ -710 +710 @@ CVQualifiers::output() const
-		cout << is_volatiles[i] << " ";
+		std::cout << is_volatiles[i] << " ";
@@ -712 +712 @@ CVQualifiers::output() const
-	cout << endl;
+	std::cout << std::endl;
diff --git a/src/CVQualifiers.h b/src/CVQualifiers.h
index 0f5a01b..d2ff6f9 100644
--- a/src/CVQualifiers.h
+++ b/src/CVQualifiers.h
@@ -35 +35,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/Common.h b/src/Common.h
index fb32c01..172e216 100644
--- a/src/Common.h
+++ b/src/Common.h
@@ -51 +50,0 @@ using std::vector;
-using namespace std ;
diff --git a/src/Constant.cpp b/src/Constant.cpp
index 409c4f0..a0dd487 100644
--- a/src/Constant.cpp
+++ b/src/Constant.cpp
@@ -47 +47,4 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::ostream;
+
@@ -169 +172 @@ GenerateRandomConstantInRange(const Type* type, int bound)
-	ostringstream oss;
+	std::ostringstream oss;
@@ -282 +285 @@ GenerateRandomConstant(const Type* type)
-		    ostringstream oss; 
+			std::ostringstream oss; 
@@ -340 +343 @@ Constant::make_random_upto(unsigned int limit)
-	ostringstream oss;
+	std::ostringstream oss;
@@ -395 +398 @@ Constant::make_int(int v)
-	ostringstream oss;
+	std::ostringstream oss;
diff --git a/src/CoverageTestExtension.cpp b/src/CoverageTestExtension.cpp
index 1e8c9c7..543c2d5 100644
--- a/src/CoverageTestExtension.cpp
+++ b/src/CoverageTestExtension.cpp
@@ -36 +36,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/CrestExtension.cpp b/src/CrestExtension.cpp
index bd79a39..7b467be 100644
--- a/src/CrestExtension.cpp
+++ b/src/CrestExtension.cpp
@@ -35 +35,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/DFSOutputMgr.cpp b/src/DFSOutputMgr.cpp
index 7f92ead..11a11fe 100644
--- a/src/DFSOutputMgr.cpp
+++ b/src/DFSOutputMgr.cpp
@@ -39 +39,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -80 +84 @@ DFSOutputMgr::OutputStructUnions(ostream& /*out*/)
-	ofstream o_struct(struct_output_.c_str());
+	std::ofstream o_struct(struct_output_.c_str());
diff --git a/src/DFSOutputMgr.h b/src/DFSOutputMgr.h
index 9f468a6..a5a1cee 100644
--- a/src/DFSOutputMgr.h
+++ b/src/DFSOutputMgr.h
@@ -45 +45 @@ public:
-	virtual void OutputStructUnions(ostream& /*out*/);
+	virtual void OutputStructUnions(std::ostream& /*out*/);
@@ -49 +49 @@ public:
-	virtual void outputln(ostream &out);
+	virtual void outputln(std::ostream &out);
@@ -51 +51 @@ public:
-	virtual void output_comment_line(ostream &out, const std::string &comment);
+	virtual void output_comment_line(std::ostream &out, const std::string &comment);
@@ -53 +53 @@ public:
-	virtual void output_tab(ostream &out, int indent);
+	virtual void output_tab(std::ostream &out, int indent);
diff --git a/src/DFSProgramGenerator.cpp b/src/DFSProgramGenerator.cpp
index e9822e2..63a4630 100644
--- a/src/DFSProgramGenerator.cpp
+++ b/src/DFSProgramGenerator.cpp
@@ -45 +45,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -86 +90 @@ DFSProgramGenerator::goGenerator()
-	output_mgr_->OutputStructUnions(cout);
+	output_mgr_->OutputStructUnions(std::cout);
@@ -93 +97 @@ DFSProgramGenerator::goGenerator()
-				//cout << "here" << std::endl;
+				//std::cout << "here" << std::endl;
@@ -96 +100 @@ DFSProgramGenerator::goGenerator()
-			OutputMgr::really_outputln(cout);
+			OutputMgr::really_outputln(std::cout);
@@ -104 +108 @@ DFSProgramGenerator::goGenerator()
-		//cout << "count = " << count << std::endl;
+		//std::cout << "count = " << count << std::endl;
diff --git a/src/DFSRndNumGenerator.cpp b/src/DFSRndNumGenerator.cpp
index 7de4354..1e3ace9 100644
--- a/src/DFSRndNumGenerator.cpp
+++ b/src/DFSRndNumGenerator.cpp
@@ -121 +121 @@ void DFSRndNumGenerator::SearchState::dump(const string &where)
-	cout << "[state]" << where << ", index = " << index_ << ", init = " << init_ << ", value = " << value_ << ", bound = " \
+	std::cout << "[state]" << where << ", index = " << index_ << ", init = " << init_ << ", value = " << value_ << ", bound = " \
@@ -195 +195 @@ DFSRndNumGenerator::dumpCurrentState(int bound, const string &where)
-	cout << "[current]" << where << ", current_pos = " << current_pos_ \
+	std::cout << "[current]" << where << ", current_pos = " << current_pos_ \
@@ -248 +248 @@ DFSRndNumGenerator::revisit_node(DFSRndNumGenerator::SearchState *state, int loc
-			cout << "rv = " << rv << ", bound = " << bound << std::endl;
+			std::cout << "rv = " << rv << ", bound = " << bound << std::endl;
@@ -290 +290 @@ DFSRndNumGenerator::random_choice (int bound, const Filter *filter, const string
-		//cout << "current_pos _ = " << current_pos_ << ", length = " << seq_->sequence_length() << std::endl;
+		//std::cout << "current_pos _ = " << current_pos_ << ", length = " << seq_->sequence_length() << std::endl;
diff --git a/src/DefaultOutputMgr.cpp b/src/DefaultOutputMgr.cpp
index c24d451..3242221 100644
--- a/src/DefaultOutputMgr.cpp
+++ b/src/DefaultOutputMgr.cpp
@@ -57 +57,2 @@ static std::string dir_sep = "\\";
-using namespace std;
+using std::vector;
+using std::string;
@@ -69 +70 @@ DefaultOutputMgr::CreateInstance()
-		ofstream *ofile = new ofstream(ofile_str.c_str());
+		std::ofstream *ofile = new std::ofstream(ofile_str.c_str());
@@ -81 +82 @@ DefaultOutputMgr::CreateInstance()
-ofstream *
+std::ofstream *
@@ -86 +87 @@ DefaultOutputMgr::open_one_output_file(int num)
-	ofstream *ofile = new ofstream(ss.str().c_str());
+	std::ofstream *ofile = new std::ofstream(ss.str().c_str());
@@ -99 +100 @@ DefaultOutputMgr::init()
-		ofstream *out = open_one_output_file(i);
+		std::ofstream *out = open_one_output_file(i);
@@ -116 +117 @@ DefaultOutputMgr::OutputGlobals()
-	ofstream ofile(ss.str().c_str());
+	std::ofstream ofile(ss.str().c_str());
@@ -133 +134 @@ DefaultOutputMgr::OutputAllHeaders()
-		ofstream *out = outs[i];
+		std::ofstream *out = outs[i];
@@ -146 +147 @@ DefaultOutputMgr::OutputAllHeaders()
-	vector<ofstream *>::iterator j;
+	std::vector<std::ofstream *>::iterator j;
@@ -148 +149 @@ DefaultOutputMgr::OutputAllHeaders()
-		ofstream *out = (*j);
+		std::ofstream *out = (*j);
@@ -164 +165 @@ DefaultOutputMgr::RandomOutputVarDefs()
-		ostream *out = outs[index];
+		std::ostream *out = outs[index];
@@ -251 +252 @@ void
-DefaultOutputMgr::outputln(ostream &out)
+DefaultOutputMgr::outputln(std::ostream &out)
@@ -257 +258 @@ void
-DefaultOutputMgr::output_comment_line(ostream &out, const std::string &comment)
+DefaultOutputMgr::output_comment_line(std::ostream &out, const std::string &comment)
@@ -263 +264 @@ void
-DefaultOutputMgr::output_tab(ostream &out, int indent)
+DefaultOutputMgr::output_tab(std::ostream &out, int indent)
diff --git a/src/DefaultOutputMgr.h b/src/DefaultOutputMgr.h
index 3e456d9..9dd776e 100644
--- a/src/DefaultOutputMgr.h
+++ b/src/DefaultOutputMgr.h
@@ -39 +39,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
@@ -53 +55 @@ public:
-	virtual void outputln(ostream &out);
+	virtual void outputln(std::ostream &out);
@@ -55 +57 @@ public:
-	virtual void output_comment_line(ostream &out, const std::string &comment);
+	virtual void output_comment_line(std::ostream &out, const std::string &comment);
@@ -57 +59 @@ public:
-	virtual void output_tab(ostream &out, int indent);
+	virtual void output_tab(std::ostream &out, int indent);
diff --git a/src/DefaultProgramGenerator.cpp b/src/DefaultProgramGenerator.cpp
index bab53ac..3fab117 100644
--- a/src/DefaultProgramGenerator.cpp
+++ b/src/DefaultProgramGenerator.cpp
@@ -95 +95 @@ DefaultProgramGenerator::goGenerator()
-		ofstream ofile;
+	    std::ofstream ofile;
diff --git a/src/DeltaMonitor.cpp b/src/DeltaMonitor.cpp
index 855ceb9..4d7e20f 100644
--- a/src/DeltaMonitor.cpp
+++ b/src/DeltaMonitor.cpp
@@ -42 +42,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -190 +194 @@ DeltaMonitor::Output(ostream &out)
-	ofstream *ofile = new ofstream(output_file_.c_str());
+	std::ofstream *ofile = new std::ofstream(output_file_.c_str());
diff --git a/src/DepthSpec.cpp b/src/DepthSpec.cpp
index ca0d2b7..b7445c3 100644
--- a/src/DepthSpec.cpp
+++ b/src/DepthSpec.cpp
@@ -45 +45,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -353 +357 @@ DepthSpec::dtSafeOpFlags_minimal_depth(int flag)
-//cout << "max_depth = " << max_depth << ", cur_depth = " << cur_depth << ", minimal = " << type##_minimal_depth(flag) << std::endl; 
+//std::cout << "max_depth = " << max_depth << ", cur_depth = " << cur_depth << ", minimal = " << type##_minimal_depth(flag) << std::endl; 
@@ -434 +438 @@ int DepthSpec::depth_guard_by_type(enum dType ty, int extra_flag)
-	cout << #type << " : size = " << type##_minimal_depth() << endl;
+	std::cout << #type << " : size = " << type##_minimal_depth() << endl;
diff --git a/src/Effect.cpp b/src/Effect.cpp
index 4556213..32b461a 100644
--- a/src/Effect.cpp
+++ b/src/Effect.cpp
@@ -38 +38,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/Enumerator.h b/src/Enumerator.h
index 3560cce..2bfbc96 100644
--- a/src/Enumerator.h
+++ b/src/Enumerator.h
@@ -36 +36,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
@@ -149 +151 @@ Enumerator<Name>::~Enumerator()
-	typename map<Name, EnumObject*>::iterator i;
+	typename std::map<Name, EnumObject*>::iterator i;
@@ -183 +185 @@ Enumerator<Name>::add_elem(Name name, int bound)
-	typename map<Name, EnumObject*>::iterator i = objs_.find(name);
+	typename std::map<Name, EnumObject*>::iterator i = objs_.find(name);
@@ -194 +196 @@ Enumerator<Name>::add_bool_elem_of_bool(Name name, bool value)
-	typename map<Name, EnumObject*>::iterator i = objs_.find(name);
+	typename std::map<Name, EnumObject*>::iterator i = objs_.find(name);
@@ -221 +223 @@ Enumerator<Name>::add_bool_elem(Name name, int value)
-	typename map<Name, EnumObject*>::iterator i = objs_.find(name);
+	typename std::map<Name, EnumObject*>::iterator i = objs_.find(name);
@@ -232 +234 @@ Enumerator<Name>::get_elem(Name name)
-	typename map<Name, EnumObject*>::iterator i = objs_.find(name);
+	typename std::map<Name, EnumObject*>::iterator i = objs_.find(name);
@@ -254 +256 @@ Enumerator<Name>::reset_after_backward_pos()
-	typename map<Name, EnumObject*>::iterator i = backward_pos_;
+	typename std::map<Name, EnumObject*>::iterator i = backward_pos_;
@@ -301 +303 @@ Enumerator<Name>::is_changed(Name name)
-	typename map<Name, EnumObject*>::iterator i = objs_.find(name);
+	typename std::map<Name, EnumObject*>::iterator i = objs_.find(name);
@@ -313 +315 @@ Enumerator<Name>::reset_all_changed()
-	typename map<Name, EnumObject*>::iterator i;
+	typename std::map<Name, EnumObject*>::iterator i;
diff --git a/src/Error.h b/src/Error.h
index 99a31ce..f763e9c 100644
--- a/src/Error.h
+++ b/src/Error.h
@@ -84 +84 @@
-	cout << "error: " << msg << ", errorno: " << Error::get_error() << std::endl; \
+	std::cout << "error: " << msg << ", errorno: " << Error::get_error() << std::endl; \
diff --git a/src/Expression.cpp b/src/Expression.cpp
index 5999429..80f1229 100644
--- a/src/Expression.cpp
+++ b/src/Expression.cpp
@@ -131 +131 @@ Expression::to_string(void) const
-	ostringstream oss;
+	std::ostringstream oss;
diff --git a/src/Expression.h b/src/Expression.h
index 6802688..45d4af8 100644
--- a/src/Expression.h
+++ b/src/Expression.h
@@ -50 +50,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/ExpressionFuncall.cpp b/src/ExpressionFuncall.cpp
index 53ad3ff..e2d525b 100644
--- a/src/ExpressionFuncall.cpp
+++ b/src/ExpressionFuncall.cpp
@@ -189 +189 @@ ExpressionFuncall::get_referenced_ptrs(std::vector<const Variable*>& ptrs) const
-		//cout << "follow " << fiu->get_func()->name << endl;
+		//std::cout << "follow " << fiu->get_func()->name << endl;
diff --git a/src/ExpressionVariable.h b/src/ExpressionVariable.h
index 1f9865a..8d35214 100644
--- a/src/ExpressionVariable.h
+++ b/src/ExpressionVariable.h
@@ -38 +38,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/ExtensionMgr.cpp b/src/ExtensionMgr.cpp
index 6b025ef..67d2574 100644
--- a/src/ExtensionMgr.cpp
+++ b/src/ExtensionMgr.cpp
@@ -43 +43,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/Fact.cpp b/src/Fact.cpp
index 06008a7..54ed5cd 100644
--- a/src/Fact.cpp
+++ b/src/Fact.cpp
@@ -39 +39,5 @@
-using namespace std; 
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+ 
@@ -209 +213 @@ merge_facts(FactVec& facts, const FactVec& new_facts)
-		//new_facts[i]->Output(cout);
+		//new_facts[i]->Output(std::cout);
@@ -298 +302 @@ print_facts(const FactVec& facts)
-		f->OutputAssertion(cout);
+		f->OutputAssertion(std::cout);
@@ -308 +312 @@ print_var_fact(const FactVec& facts, const char* vname)
-			f->OutputAssertion(cout);
+			f->OutputAssertion(std::cout);
diff --git a/src/Fact.h b/src/Fact.h
index d4e59b7..8877033 100644
--- a/src/Fact.h
+++ b/src/Fact.h
@@ -37 +37,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/FactMgr.cpp b/src/FactMgr.cpp
index b10fd71..c9bcaf9 100644
--- a/src/FactMgr.cpp
+++ b/src/FactMgr.cpp
@@ -62 +62,3 @@
-using namespace std; 
+using std::vector;
+using std::string;
+using std::ostream;
@@ -84 +86 @@ FactMgr::add_new_var_fact_and_update_inout_maps(const Block* blk, const Variable
-			map<const Statement*, FactVec>::iterator iter;
+			std::map<const Statement*, FactVec>::iterator iter;
@@ -216 +218 @@ FactMgr::setup_in_out_maps(bool first_time)
-		map<const Statement*, vector<const Fact*> >::const_iterator iter;
+		std::map<const Statement*, vector<const Fact*> >::const_iterator iter;
@@ -231 +233 @@ FactMgr::setup_in_out_maps(bool first_time)
-		map<const Statement*, vector<Fact*> >::iterator iter;
+		std::map<const Statement*, vector<Fact*> >::iterator iter;
@@ -533 +535 @@ FactMgr::clear_map_visited(void)
-	map<const Statement*, bool>::iterator iter;
+	std::map<const Statement*, bool>::iterator iter;
@@ -540 +542 @@ void
-FactMgr::backup_stm_fact_maps(const Statement* stm, map<const Statement*, FactVec>& facts_in, map<const Statement*, FactVec>& facts_out)
+FactMgr::backup_stm_fact_maps(const Statement* stm, std::map<const Statement*, FactVec>& facts_in, std::map<const Statement*, FactVec>& facts_out)
@@ -557 +559 @@ void
-FactMgr::restore_stm_fact_maps(const Statement* stm, map<const Statement*, FactVec>& facts_in, map<const Statement*, FactVec>& facts_out)
+FactMgr::restore_stm_fact_maps(const Statement* stm, std::map<const Statement*, FactVec>& facts_in, std::map<const Statement*, FactVec>& facts_out)
@@ -738 +740 @@ FactMgr::sanity_check_map() const
-	map<const Statement*, vector<const Fact*> >::const_iterator iter; 
+	std::map<const Statement*, vector<const Fact*> >::const_iterator iter; 
diff --git a/src/FactMgr.h b/src/FactMgr.h
index 8a17885..41e45db 100644
--- a/src/FactMgr.h
+++ b/src/FactMgr.h
@@ -61 +61,3 @@ class CFGEdge;
-using namespace std; 
+using std::vector;
+using std::string;
+ 
@@ -99,2 +101,2 @@ public:
-	void backup_stm_fact_maps(const Statement* stm, map<const Statement*, FactVec>& facts_in, map<const Statement*, FactVec>& facts_out);
-	void restore_stm_fact_maps(const Statement* stm, map<const Statement*, FactVec>& facts_in, map<const Statement*, FactVec>& facts_out);
+	void backup_stm_fact_maps(const Statement* stm, std::map<const Statement*, FactVec>& facts_in, std::map<const Statement*, FactVec>& facts_out);
+	void restore_stm_fact_maps(const Statement* stm, std::map<const Statement*, FactVec>& facts_in, std::map<const Statement*, FactVec>& facts_out);
diff --git a/src/FactPointTo.cpp b/src/FactPointTo.cpp
index 523968a..dafd250 100644
--- a/src/FactPointTo.cpp
+++ b/src/FactPointTo.cpp
@@ -54 +54,5 @@
-using namespace std; 
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+ 
@@ -837 +841 @@ FactPointTo::aggregate_all_pointto_sets(void)
-		map<const Statement*, vector<Fact*> >::iterator iter; 
+		std::map<const Statement*, vector<Fact*> >::iterator iter; 
diff --git a/src/FactPointTo.h b/src/FactPointTo.h
index 30ffa9d..c92b66b 100644
--- a/src/FactPointTo.h
+++ b/src/FactPointTo.h
@@ -47 +47,3 @@ class StatementReturn;
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/FactUnion.h b/src/FactUnion.h
index 01ab9fb..c34e5df 100644
--- a/src/FactUnion.h
+++ b/src/FactUnion.h
@@ -45 +45,3 @@ class StatementReturn;
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/Filter.cpp b/src/Filter.cpp
index 6b71795..3810ebb 100644
--- a/src/Filter.cpp
+++ b/src/Filter.cpp
@@ -36 +36,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/Function.cpp b/src/Function.cpp
index b47a0f6..6834811 100644
--- a/src/Function.cpp
+++ b/src/Function.cpp
@@ -66 +66,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -547 +551 @@ Function::GenerateBody(const CGContext &prev_context)
-		cerr << "warning: ignoring attempt to regenerate func" << endl;
+		std::cerr << "warning: ignoring attempt to regenerate func" << std::endl;
@@ -586 +590 @@ Function::generate_body_with_known_params(const CGContext &prev_context, Effect&
-		cerr << "warning: ignoring attempt to regenerate func" << endl;
+		std::cerr << "warning: ignoring attempt to regenerate func" << endl;
diff --git a/src/Function.h b/src/Function.h
index e664b26..66773cb 100644
--- a/src/Function.h
+++ b/src/Function.h
@@ -46 +46,2 @@
-using namespace std;
+using std::vector;
+using std::string;
diff --git a/src/FunctionInvocation.cpp b/src/FunctionInvocation.cpp
index 68da6ab..5086d43 100644
--- a/src/FunctionInvocation.cpp
+++ b/src/FunctionInvocation.cpp
@@ -68 +68,5 @@
-using namespace std; 
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+ 
diff --git a/src/FunctionInvocation.h b/src/FunctionInvocation.h
index 12076af..4bc4821 100644
--- a/src/FunctionInvocation.h
+++ b/src/FunctionInvocation.h
@@ -48 +48,2 @@
-using namespace std;
+using std::vector;
+using std::string;
diff --git a/src/FunctionInvocationBinary.cpp b/src/FunctionInvocationBinary.cpp
index b4c98a1..60d4b51 100644
--- a/src/FunctionInvocationBinary.cpp
+++ b/src/FunctionInvocationBinary.cpp
@@ -44 +44,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/FunctionInvocationUnary.cpp b/src/FunctionInvocationUnary.cpp
index 4cf26b5..b41118a 100644
--- a/src/FunctionInvocationUnary.cpp
+++ b/src/FunctionInvocationUnary.cpp
@@ -42 +42,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/FunctionInvocationUser.cpp b/src/FunctionInvocationUser.cpp
index 85d27b7..25c3eca 100644
--- a/src/FunctionInvocationUser.cpp
+++ b/src/FunctionInvocationUser.cpp
@@ -65 +65,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -320,3 +324,3 @@ FunctionInvocationUser::revisit(std::vector<const Fact*>& inputs, CGContext& cg_
-		//cout << func->visited_cnt << endl;
-		//func->Output(cout);
-		//cout << endl;
+		//std::cout << func->visited_cnt << endl;
+		//func->Output(std::cout);
+		//std::cout << endl;
@@ -331,4 +335,4 @@ FunctionInvocationUser::revisit(std::vector<const Fact*>& inputs, CGContext& cg_
-	map<const Statement*, FactVec> facts_in_copy = fm->map_facts_in;
-	map<const Statement*, FactVec> facts_out_copy = fm->map_facts_out;
-	map<const Statement*, Effect>  stm_effect_copy = fm->map_stm_effect;
-	map<const Statement*, Effect>  accum_effect_copy = fm->map_accum_effect;
+	std::map<const Statement*, FactVec> facts_in_copy = fm->map_facts_in;
+	std::map<const Statement*, FactVec> facts_out_copy = fm->map_facts_out;
+	std::map<const Statement*, Effect>  stm_effect_copy = fm->map_stm_effect;
+	std::map<const Statement*, Effect>  accum_effect_copy = fm->map_accum_effect;
diff --git a/src/KleeExtension.cpp b/src/KleeExtension.cpp
index 81e1c33..b187e68 100644
--- a/src/KleeExtension.cpp
+++ b/src/KleeExtension.cpp
@@ -35 +35,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/Lhs.cpp b/src/Lhs.cpp
index 19787db..5492581 100644
--- a/src/Lhs.cpp
+++ b/src/Lhs.cpp
@@ -51 +51,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/LinearSequence.cpp b/src/LinearSequence.cpp
index 05f0bed..c9f2458 100644
--- a/src/LinearSequence.cpp
+++ b/src/LinearSequence.cpp
@@ -38 +38,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/OutputMgr.cpp b/src/OutputMgr.cpp
index 98152d3..1e6ecd5 100644
--- a/src/OutputMgr.cpp
+++ b/src/OutputMgr.cpp
@@ -67 +67,5 @@ static const char volatile_include[] = "\
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/OutputMgr.h b/src/OutputMgr.h
index 0352e5d..8e4968c 100644
--- a/src/OutputMgr.h
+++ b/src/OutputMgr.h
@@ -36 +36,2 @@
-using namespace std;
+using std::vector;
+using std::string;
@@ -84 +85 @@ public:
-	virtual void OutputStructUnions(ostream& /* out */) {};
+	virtual void OutputStructUnions(std::ostream& /* out */) {};
@@ -88 +89 @@ public:
-	virtual void outputln(ostream &out) {out << std::endl;}
+	virtual void outputln(std::ostream &out) {out << std::endl;}
@@ -90 +91 @@ public:
-	virtual void output_comment_line(ostream &out, const std::string &comment);
+	virtual void output_comment_line(std::ostream &out, const std::string &comment);
@@ -92 +93 @@ public:
-	virtual void output_tab(ostream &out, int indent);
+	virtual void output_tab(std::ostream &out, int indent);
@@ -94 +95 @@ public:
-	void OutputPtrResets(ostream &out, const vector<const Variable*>& ptrs);
+	void OutputPtrResets(std::ostream &out, const vector<const Variable*>& ptrs);
@@ -105 +106 @@ protected:
-	static void output_tab_(ostream &out, int indent);
+	static void output_tab_(std::ostream &out, int indent);
diff --git a/src/PartialExpander.cpp b/src/PartialExpander.cpp
index 1c01a16..d4c8af7 100644
--- a/src/PartialExpander.cpp
+++ b/src/PartialExpander.cpp
@@ -34 +34,2 @@
-using namespace std;
+using std::vector;
+
@@ -41 +42 @@ void
-print_map(const map<eStatementType, bool> &m)
+print_map(const std::map<eStatementType, bool> &m)
@@ -45 +46 @@ print_map(const map<eStatementType, bool> &m)
-		cout << "t = " << (*i).first << " , v = " << (*i).second << std::endl;
+		std::cout << "t = " << (*i).first << " , v = " << (*i).second << std::endl;
@@ -50 +51 @@ void
-PartialExpander::init_map(map<eStatementType, bool> &m, bool value)
+PartialExpander::init_map(std::map<eStatementType, bool> &m, bool value)
@@ -133 +134 @@ void
-PartialExpander::copy_expands(std::map<eStatementType, bool> &dest, const map<eStatementType, bool> &src)
+PartialExpander::copy_expands(std::map<eStatementType, bool> &dest, const std::map<eStatementType, bool> &src)
diff --git a/src/PartialExpander.h b/src/PartialExpander.h
index 38949d3..2e0314e 100644
--- a/src/PartialExpander.h
+++ b/src/PartialExpander.h
@@ -52 +52 @@ private:
-	static void init_map(map<eStatementType, bool> &m, bool value);
+	static void init_map(std::map<eStatementType, bool> &m, bool value);
@@ -56 +56 @@ private:
-	static void copy_expands(std::map<eStatementType, bool> &dest, const map<eStatementType, bool> &src);
+	static void copy_expands(std::map<eStatementType, bool> &dest, const std::map<eStatementType, bool> &src);
diff --git a/src/Probabilities.cpp b/src/Probabilities.cpp
index ac38ac8..8362106 100644
--- a/src/Probabilities.cpp
+++ b/src/Probabilities.cpp
@@ -51 +51,4 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::ostream;
+using std::ifstream;
@@ -78 +81 @@ ProbabilityFilter::filter(int v) const
-	map<ProbName, SingleProbElem *>::iterator i;
+	std::map<ProbName, SingleProbElem *>::iterator i;
@@ -296 +299 @@ GroupProbElem::set_prob_table(ProbabilityTable<unsigned int, ProbName> * const t
-	map<ProbName, SingleProbElem*>::iterator i;
+	std::map<ProbName, SingleProbElem*>::iterator i;
@@ -312 +315 @@ GroupProbElem::get_all_values(vector<SingleProbElem*> &values)
-	map<ProbName, SingleProbElem*>::iterator i;
+	std::map<ProbName, SingleProbElem*>::iterator i;
@@ -348 +351 @@ GroupProbElem::dump_val(std::ostream &out)
-	map<ProbName, SingleProbElem*>::iterator i = probs_.begin();
+	std::map<ProbName, SingleProbElem*>::iterator i = probs_.begin();
@@ -881 +884 @@ Probabilities::setup_group_probabilities(bool is_equal, const vector<string> &el
-	set<int> vals;
+	std::set<int> vals;
@@ -986 +989 @@ Probabilities::dump_default_probabilities(const string &fname)
-	ofstream *out = new ofstream(fname.c_str());
+	std::ofstream *out = new std::ofstream(fname.c_str());
@@ -999 +1002 @@ Probabilities::dump_actual_probabilities(const string &fname, unsigned long seed
-	ofstream *out = new ofstream(fname.c_str());
+	std::ofstream *out = new std::ofstream(fname.c_str());
diff --git a/src/Probabilities.h b/src/Probabilities.h
index fcfb45c..a98b24b 100644
--- a/src/Probabilities.h
+++ b/src/Probabilities.h
@@ -42 +42,3 @@ class ProbabilityTable;
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/ProbabilityTable.h b/src/ProbabilityTable.h
index b0d2578..78c7763 100644
--- a/src/ProbabilityTable.h
+++ b/src/ProbabilityTable.h
@@ -42 +42,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/RandomProgramGenerator.cpp b/src/RandomProgramGenerator.cpp
index b5f90bd..52648d4 100644
--- a/src/RandomProgramGenerator.cpp
+++ b/src/RandomProgramGenerator.cpp
@@ -94 +94,5 @@ FUTURE:
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -110 +114 @@ print_version(void)
-	cout << PACKAGE_STRING << endl;
+	std::cout << PACKAGE_STRING << endl;
@@ -112 +116 @@ print_version(void)
-	cout << "Git version: " << GIT_VERSION << endl;
+	std::cout << "Git version: " << GIT_VERSION << endl;
@@ -133 +137 @@ parse_int_arg(char *arg, unsigned long *ret)
-		cout << "expected integer at arg position " << endl;
+		std::cout << "expected integer at arg position " << endl;
@@ -141 +145 @@ static void print_help()
-	cout << "Command line options: " << endl << endl; 
+	std::cout << "Command line options: " << endl << endl; 
@@ -143,5 +147,5 @@ static void print_help()
-	cout << "  --help or -h: print this information." << endl << endl; 
-	cout << "  -hh: describe extra options probably useful only for Csmith developers." << endl << endl; 
-	cout << "  --version or -v: print the version of Csmith." << endl << endl; 
-	cout << "  --seed <seed> or -s <seed>: use <seed> instead of a random seed generated by Csmith." << endl << endl;
-	cout << "  --output <filename> or -o <filename>: specify the output file name." << endl << endl;
+	std::cout << "  --help or -h: print this information." << endl << endl; 
+	std::cout << "  -hh: describe extra options probably useful only for Csmith developers." << endl << endl; 
+	std::cout << "  --version or -v: print the version of Csmith." << endl << endl; 
+	std::cout << "  --seed <seed> or -s <seed>: use <seed> instead of a random seed generated by Csmith." << endl << endl;
+	std::cout << "  --output <filename> or -o <filename>: specify the output file name." << endl << endl;
@@ -150,15 +154,15 @@ static void print_help()
-	cout << "  --argc | --no-argc: genereate main function with/without argv and argc being passed (enabled by default)." << endl << endl; 
-	cout << "  --arrays | --no-arrays: enable | disable arrays (enabled by default)." << endl << endl;
-	cout << "  --bitfields | --no-bitfields: enable | disable full-bitfields structs (disabled by default)." << endl << endl;
-	cout << "  --checksum | --no-checksum: enable | disable checksum calculation (enabled by default)." << endl << endl;
-	cout << "  --comma-operators | --no-comma-operators: enable | disable comma operators (enabled by default)." << endl << endl;
-	cout << "  --compound-assignment | --no-compound-assignment: enable | disable compound assignments (enabled by default)." << endl << endl; 
-	cout << "  --concise: generated programs with minimal comments (disabled by default)." << endl << endl;
-	cout << "  --consts | --no-consts: enable | disable const qualifier (enabled by default)." << endl << endl;
-	cout << "  --divs | --no-divs: enable | disable divisions (enabled by default)." << endl << endl;
-	cout << "  --embedded-assigns | --no-embedded-assigns: enable | disable embedded assignments as sub-expressions (enabled by default)." << endl << endl;
-	cout << "  --incr-decr-operators | --no-incr-decr-operators: enable | disable ++/-- operators (enabled by default)." << endl << endl;
-	cout << "  --jumps | --no-jumps: enable | disable jumps (enabled by default)." << endl << endl;
-	cout << "  --longlong| --no-longlong: enable | disable long long (enabled by default)." << endl << endl;
-	cout << "  --main | --nomain: enable | disable to generate main function (enabled by default)." << endl <<  endl;  
-	cout << "  --math64 | --no-math64: enable | disable 64-bit math ops (enabled by default)." << endl << endl;
+	std::cout << "  --argc | --no-argc: genereate main function with/without argv and argc being passed (enabled by default)." << endl << endl; 
+	std::cout << "  --arrays | --no-arrays: enable | disable arrays (enabled by default)." << endl << endl;
+	std::cout << "  --bitfields | --no-bitfields: enable | disable full-bitfields structs (disabled by default)." << endl << endl;
+	std::cout << "  --checksum | --no-checksum: enable | disable checksum calculation (enabled by default)." << endl << endl;
+	std::cout << "  --comma-operators | --no-comma-operators: enable | disable comma operators (enabled by default)." << endl << endl;
+	std::cout << "  --compound-assignment | --no-compound-assignment: enable | disable compound assignments (enabled by default)." << endl << endl; 
+	std::cout << "  --concise: generated programs with minimal comments (disabled by default)." << endl << endl;
+	std::cout << "  --consts | --no-consts: enable | disable const qualifier (enabled by default)." << endl << endl;
+	std::cout << "  --divs | --no-divs: enable | disable divisions (enabled by default)." << endl << endl;
+	std::cout << "  --embedded-assigns | --no-embedded-assigns: enable | disable embedded assignments as sub-expressions (enabled by default)." << endl << endl;
+	std::cout << "  --incr-decr-operators | --no-incr-decr-operators: enable | disable ++/-- operators (enabled by default)." << endl << endl;
+	std::cout << "  --jumps | --no-jumps: enable | disable jumps (enabled by default)." << endl << endl;
+	std::cout << "  --longlong| --no-longlong: enable | disable long long (enabled by default)." << endl << endl;
+	std::cout << "  --main | --nomain: enable | disable to generate main function (enabled by default)." << endl <<  endl;  
+	std::cout << "  --math64 | --no-math64: enable | disable 64-bit math ops (enabled by default)." << endl << endl;
@@ -167,20 +171,20 @@ static void print_help()
-	cout << "  --max-array-dim <num>: limit array dimensions to <num>. (default 3)" << endl << endl;
-	cout << "  --max-array-len-per-dim <num>: limit array length per dimension to <num> (default 10)." << endl << endl;
-	cout << "  --max-block-depth <num>: limit depth of nested blocks to <num> (default 5)." << endl << endl;
-	cout << "  --max-block-size <size>: limit the number of non-return statements in a block to <size> (default 4)." << endl << endl; 
-	cout << "  --max-expr-complexity <num>: limit expression complexities to <num> (default 10)." << endl << endl;
-	cout << "  --max-funcs <num>: limit the number of functions (besides main) to <num>  (default 10)." << endl << endl;
-	cout << "  --max-pointer-depth <depth>: limit the indirect depth of pointers to <depth> (default 2)." << endl << endl;
-	cout << "  --max-struct-fields <num>: limit the number of struct fields to <num> (default 10). " << endl << endl;
-	cout << "  --max-union-fields <num>: limit the number of union fields to <num> (default 5). " << endl << endl;
-
-	cout << "  --muls | --no-muls: enable | disable multiplications (enabled by default)." << endl << endl;
-	cout << "  --no-safe-math: Do not emit safe math wrapper functions." << endl << endl;
-	cout << "  --packed-struct | --no-packed-struct: enable | disable packed structs by adding #pragma pack(1) before struct definition (disabled by default)." << endl << endl; 
-	cout << "  --paranoid | --no-paranoid: enable | disable pointer-related assertions (disabled by default)." << endl << endl; 
-	cout << "  --pointers | --no-pointers: enable | disable pointers (enabled by default)." << endl << endl;
-	cout << "  --quiet: generate programs with less comments (disabled by default)." << endl << endl; 
-	cout << "  --structs | --no-structs: enable | disable to generate structs (enable by default)." << endl << endl;
-	cout << "  --unions | --no-unions: enable | disable to generate unions (enable by default)." << endl << endl;
-	cout << "  --volatiles | --no-volatiles: enable | disable volatiles (enabled by default)." << endl << endl;
-	cout << "  --volatile-pointers | --no-volatile-pointers: enable | disable volatile pointers (enabled by default)." << endl << endl;
+	std::cout << "  --max-array-dim <num>: limit array dimensions to <num>. (default 3)" << endl << endl;
+	std::cout << "  --max-array-len-per-dim <num>: limit array length per dimension to <num> (default 10)." << endl << endl;
+	std::cout << "  --max-block-depth <num>: limit depth of nested blocks to <num> (default 5)." << endl << endl;
+	std::cout << "  --max-block-size <size>: limit the number of non-return statements in a block to <size> (default 4)." << endl << endl; 
+	std::cout << "  --max-expr-complexity <num>: limit expression complexities to <num> (default 10)." << endl << endl;
+	std::cout << "  --max-funcs <num>: limit the number of functions (besides main) to <num>  (default 10)." << endl << endl;
+	std::cout << "  --max-pointer-depth <depth>: limit the indirect depth of pointers to <depth> (default 2)." << endl << endl;
+	std::cout << "  --max-struct-fields <num>: limit the number of struct fields to <num> (default 10). " << endl << endl;
+	std::cout << "  --max-union-fields <num>: limit the number of union fields to <num> (default 5). " << endl << endl;
+
+	std::cout << "  --muls | --no-muls: enable | disable multiplications (enabled by default)." << endl << endl;
+	std::cout << "  --no-safe-math: Do not emit safe math wrapper functions." << endl << endl;
+	std::cout << "  --packed-struct | --no-packed-struct: enable | disable packed structs by adding #pragma pack(1) before struct definition (disabled by default)." << endl << endl; 
+	std::cout << "  --paranoid | --no-paranoid: enable | disable pointer-related assertions (disabled by default)." << endl << endl; 
+	std::cout << "  --pointers | --no-pointers: enable | disable pointers (enabled by default)." << endl << endl;
+	std::cout << "  --quiet: generate programs with less comments (disabled by default)." << endl << endl; 
+	std::cout << "  --structs | --no-structs: enable | disable to generate structs (enable by default)." << endl << endl;
+	std::cout << "  --unions | --no-unions: enable | disable to generate unions (enable by default)." << endl << endl;
+	std::cout << "  --volatiles | --no-volatiles: enable | disable volatiles (enabled by default)." << endl << endl;
+	std::cout << "  --volatile-pointers | --no-volatile-pointers: enable | disable volatile pointers (enabled by default)." << endl << endl;
@@ -192,2 +196,2 @@ static void print_advanced_help()
-	cout << "'Advanced' command line options that are probably only useful for Csmith's" << endl;
-	cout << "original developers:" << endl << endl; 
+	std::cout << "'Advanced' command line options that are probably only useful for Csmith's" << endl;
+	std::cout << "original developers:" << endl << endl; 
@@ -195,2 +199,2 @@ static void print_advanced_help()
-	cout << "  --max-split-files <num>: evenly split a generated program into <num> different files(default 0)." << endl << endl;
-	cout << "  --split-files-dir <dir>: generate split-files into <dir> (default ./output)." << endl << endl; 
+	std::cout << "  --max-split-files <num>: evenly split a generated program into <num> different files(default 0)." << endl << endl;
+	std::cout << "  --split-files-dir <dir>: generate split-files into <dir> (default ./output)." << endl << endl; 
@@ -199,3 +203,3 @@ static void print_advanced_help()
-	cout << "  --dfs-exhaustive: enable depth first exhaustive random generation (disabled by default)." << endl << endl;
-	cout << "  --expand-struct: enable the expansion of struct in the exhaustive mode. ";
-	cout << "Only works in the exhaustive mode and cannot used with --no-structs." << endl << endl; 
+	std::cout << "  --dfs-exhaustive: enable depth first exhaustive random generation (disabled by default)." << endl << endl;
+	std::cout << "  --expand-struct: enable the expansion of struct in the exhaustive mode. ";
+	std::cout << "Only works in the exhaustive mode and cannot used with --no-structs." << endl << endl; 
@@ -203,2 +207,2 @@ static void print_advanced_help()
-	cout << "  --compact-output: print generated programs in compact way. ";
-	cout << "Only works in the exhaustive mode." << endl << endl;
+	std::cout << "  --compact-output: print generated programs in compact way. ";
+	std::cout << "Only works in the exhaustive mode." << endl << endl;
@@ -206,2 +210,2 @@ static void print_advanced_help()
-	cout << "  --max-nested-struct-level <num>: limit maximum nested level of structs to <num>(default 0). ";
-	cout << "Only works in the exhaustive mode." << endl << endl;
+	std::cout << "  --max-nested-struct-level <num>: limit maximum nested level of structs to <num>(default 0). ";
+	std::cout << "Only works in the exhaustive mode." << endl << endl;
@@ -209,2 +213,2 @@ static void print_advanced_help()
-	cout << "  --struct-output <file>: dump structs declarations to <file>. ";
-	cout << "Only works in the exhaustive mode." << endl << endl;
+	std::cout << "  --struct-output <file>: dump structs declarations to <file>. ";
+	std::cout << "Only works in the exhaustive mode." << endl << endl;
@@ -212,2 +216,2 @@ static void print_advanced_help()
-	cout << "  --prefix-name: prefix names of global functions and variables with increasing numbers. ";
-	cout << "Only works in the exhaustive mode." << endl << endl;
+	std::cout << "  --prefix-name: prefix names of global functions and variables with increasing numbers. ";
+	std::cout << "Only works in the exhaustive mode." << endl << endl;
@@ -215,2 +219,2 @@ static void print_advanced_help()
-	cout << "  --sequence-name-prefix: prefix names of global functions and variables with sequence numbers.";
-	cout << "Only works in the exhaustive mode." << endl << endl;
+	std::cout << "  --sequence-name-prefix: prefix names of global functions and variables with sequence numbers.";
+	std::cout << "Only works in the exhaustive mode." << endl << endl;
@@ -218,2 +222,2 @@ static void print_advanced_help()
-	cout << "  --compatible-check: disallow trivial code such as i = i in random programs. ";
-	cout << "Only works in the exhaustive mode." << endl << endl;
+	std::cout << "  --compatible-check: disallow trivial code such as i = i in random programs. ";
+	std::cout << "Only works in the exhaustive mode." << endl << endl;
@@ -222,2 +226,2 @@ static void print_advanced_help()
-	cout << "  --msp: enable certain msp related features " << endl << endl; 
-	cout << "  --ccomp: generate compcert-compatible code" << endl << endl;
+	std::cout << "  --msp: enable certain msp related features " << endl << endl; 
+	std::cout << "  --ccomp: generate compcert-compatible code" << endl << endl;
@@ -226,3 +230,3 @@ static void print_advanced_help()
-	cout << "  --splat: enable splat extension" << endl << endl; 
-	cout << "  --klee: enable klee extension" << endl << endl; 
-	cout << "  --crest: enable crest extension" << endl << endl;  
+	std::cout << "  --splat: enable splat extension" << endl << endl; 
+	std::cout << "  --klee: enable klee extension" << endl << endl; 
+	std::cout << "  --crest: enable crest extension" << endl << endl;  
@@ -231,3 +235,3 @@ static void print_advanced_help()
-	cout << "  --coverage-test: enable coverage-test extension" << endl << endl; 
-	cout << "  --coverage-test-size <num>: specify size (default 500) of the array generated to test coverage. ";
-	cout << "Can only be used with --coverage-test." << endl << endl; 
+	std::cout << "  --coverage-test: enable coverage-test extension" << endl << endl; 
+	std::cout << "  --coverage-test-size <num>: specify size (default 500) of the array generated to test coverage. ";
+	std::cout << "Can only be used with --coverage-test." << endl << endl; 
@@ -235,2 +239,2 @@ static void print_advanced_help()
-	cout << "  --func1_max_params <num>: specify the number of symbolic variables passed to func_1 (default 3). ";
-	cout << "Only used when --splat | --crest | --klee | --coverage-test is enabled." << endl << endl;
+	std::cout << "  --func1_max_params <num>: specify the number of symbolic variables passed to func_1 (default 3). ";
+	std::cout << "Only used when --splat | --crest | --klee | --coverage-test is enabled." << endl << endl;
@@ -239,5 +243,5 @@ static void print_advanced_help()
-	cout << "  --fixed-struct-fields: fix the size of struct fields to max-struct-fields (default 10)." << endl << endl; 
-	cout << "  --return-structs | --no-return-structs: enable | disable return structs from a function (enabled by default)." << endl << endl; 
-	cout << "  --arg-structs | --no-arg-structs: enable | disable structs being used as args (enabled by default)." << endl << endl; 
-	cout << "  --return-unions | --no-return-unions: enable | disable return unions from a function (enabled by default)." << endl << endl; 
-	cout << "  --arg-unions | --no-arg-unions: enable | disable unions being used as args (enabled by default)." << endl << endl; 
+	std::cout << "  --fixed-struct-fields: fix the size of struct fields to max-struct-fields (default 10)." << endl << endl; 
+	std::cout << "  --return-structs | --no-return-structs: enable | disable return structs from a function (enabled by default)." << endl << endl; 
+	std::cout << "  --arg-structs | --no-arg-structs: enable | disable structs being used as args (enabled by default)." << endl << endl; 
+	std::cout << "  --return-unions | --no-return-unions: enable | disable return unions from a function (enabled by default)." << endl << endl; 
+	std::cout << "  --arg-unions | --no-arg-unions: enable | disable unions being used as args (enabled by default)." << endl << endl; 
@@ -246,6 +250,6 @@ static void print_advanced_help()
-	cout << "  --delta-monitor [simple]: specify the type of delta monitor. Only [simple] type is supported now." << endl << endl;
-	cout << "  --delta-input [file]: specify the file for delta input." << endl << endl; 
-	cout << "  --delta-output [file]: specify the file for delta output (default to <delta-input>)." << endl << endl;
-	cout << "  --go-delta [simple]: run delta reduction on <delta-input>." << endl << endl;
-	cout << "  --no-delta-reduction: output the same program as <delta-input>. ";
-	cout << "Only works with --go-delta option." << endl << endl;
+	std::cout << "  --delta-monitor [simple]: specify the type of delta monitor. Only [simple] type is supported now." << endl << endl;
+	std::cout << "  --delta-input [file]: specify the file for delta input." << endl << endl; 
+	std::cout << "  --delta-output [file]: specify the file for delta output (default to <delta-input>)." << endl << endl;
+	std::cout << "  --go-delta [simple]: run delta reduction on <delta-input>." << endl << endl;
+	std::cout << "  --no-delta-reduction: output the same program as <delta-input>. ";
+	std::cout << "Only works with --go-delta option." << endl << endl;
@@ -254,4 +258,4 @@ static void print_advanced_help()
-	cout << "  --dump-default-probabilities <file>: dump the default probability settings into <file>" << endl << endl;
-	cout << "  --dump-random-probabilities <file>: dump the randomized probabilities into <file>" << endl << endl;
-	cout << "  --probability-configuration <file>: use probability configuration <file>" << endl << endl;
-	cout << "  --random-random: enable random probabilities." << endl << endl;
+	std::cout << "  --dump-default-probabilities <file>: dump the default probability settings into <file>" << endl << endl;
+	std::cout << "  --dump-random-probabilities <file>: dump the randomized probabilities into <file>" << endl << endl;
+	std::cout << "  --probability-configuration <file>: use probability configuration <file>" << endl << endl;
+	std::cout << "  --random-random: enable random probabilities." << endl << endl;
@@ -260,2 +264,2 @@ static void print_advanced_help()
-	cout << "  --enable-volatile-tests=[x86|x86_64] : generate code to cooperate with the Pin tool to enable volatile tests." << endl << endl;
-	cout << "  --vol-addr-file=[file]: specify the file to dump volatile addresses (default vol_addr.txt)." << endl << endl;
+	std::cout << "  --enable-volatile-tests=[x86|x86_64] : generate code to cooperate with the Pin tool to enable volatile tests." << endl << endl;
+	std::cout << "  --vol-addr-file=[file]: specify the file to dump volatile addresses (default vol_addr.txt)." << endl << endl;
@@ -264 +268 @@ static void print_advanced_help()
-	cout << "  --math-notmp: make csmith generate code for safe_math_macros_notmp." << endl << endl;
+	std::cout << "  --math-notmp: make csmith generate code for safe_math_macros_notmp." << endl << endl;
@@ -266 +270 @@ static void print_advanced_help()
-	cout << "  --strict-const-arrays: restrict array elements to constants." << endl << endl;
+	std::cout << "  --strict-const-arrays: restrict array elements to constants." << endl << endl;
@@ -268,3 +272,3 @@ static void print_advanced_help()
-	cout << "  --partial-expand <assignment[,for[,block[,if-else[,invoke[,return]]]]]: ";
-	cout <<"partial-expand controls which what kind of statements should be generated first. ";
-	cout <<"For example, it could make Csmith start to generate if-else without go over assignment or for." << endl << endl;
+	std::cout << "  --partial-expand <assignment[,for[,block[,if-else[,invoke[,return]]]]]: ";
+	std::cout <<"partial-expand controls which what kind of statements should be generated first. ";
+	std::cout <<"For example, it could make Csmith start to generate if-else without go over assignment or for." << endl << endl;
@@ -272 +276 @@ static void print_advanced_help()
-	cout << "  --dangling-global-pointers | --no-dangling-global-pointers: enable | disable to reset all dangling global pointers to null at the end of main. (enabled by default)" << endl << endl;
+	std::cout << "  --dangling-global-pointers | --no-dangling-global-pointers: enable | disable to reset all dangling global pointers to null at the end of main. (enabled by default)" << endl << endl;
@@ -274 +278 @@ static void print_advanced_help()
-	cout << "  --check-global: print the values of all integer global variables." << endl << endl;
+	std::cout << "  --check-global: print the values of all integer global variables." << endl << endl;
@@ -276 +280 @@ static void print_advanced_help()
-	cout << "  --monitor-funcs <name1,name2...>: dump the checksums after each statement in the monitored functions." << endl << endl;
+	std::cout << "  --monitor-funcs <name1,name2...>: dump the checksums after each statement in the monitored functions." << endl << endl;
@@ -278 +282 @@ static void print_advanced_help()
-	cout << "  --step-hash-by-stmt: dump the checksum after each statement. It is applied to all functions unless --monitor-funcs is specified." << endl << endl;
+	std::cout << "  --step-hash-by-stmt: dump the checksum after each statement. It is applied to all functions unless --monitor-funcs is specified." << endl << endl;
@@ -280 +284 @@ static void print_advanced_help()
-	cout << "  --stop-by-stmt <num>: try to stop generating statements after the statement with id <num>." << endl << endl;
+	std::cout << "  --stop-by-stmt <num>: try to stop generating statements after the statement with id <num>." << endl << endl;
@@ -282 +286 @@ static void print_advanced_help()
-	cout << "  --const-as-condition: enable const to be conditions of if-statements. " << endl << endl;
+	std::cout << "  --const-as-condition: enable const to be conditions of if-statements. " << endl << endl;
@@ -284 +288 @@ static void print_advanced_help()
-	cout << "  --match-exact-qualifiers: match exact const/volatile qualifiers for LHS and RHS of assignments." << endl << endl;
+	std::cout << "  --match-exact-qualifiers: match exact const/volatile qualifiers for LHS and RHS of assignments." << endl << endl;
@@ -286 +290 @@ static void print_advanced_help()
-	cout << "  --reduce <file>: reduce random program under the direction of the configuration file." << endl << endl;
+	std::cout << "  --reduce <file>: reduce random program under the direction of the configuration file." << endl << endl;
@@ -288 +292 @@ static void print_advanced_help()
-	cout << "  --return-dead-pointer | --no-return-dead-pointer: allow | disallow functions from returning dangling pointers (disallowed by default)." << endl << endl;
+	std::cout << "  --return-dead-pointer | --no-return-dead-pointer: allow | disallow functions from returning dangling pointers (disallowed by default)." << endl << endl;
@@ -290 +294 @@ static void print_advanced_help()
-	cout <<	"  --identify-wrappers: assign ids to used safe math wrappers." << endl << endl;
+	std::cout <<	"  --identify-wrappers: assign ids to used safe math wrappers." << endl << endl;
@@ -292 +296 @@ static void print_advanced_help()
-	cout << "  --safe-math-wrappers <id1,id2...>: specifiy ids of wrapper functions that are necessary to avoid undefined behaviors, use 0 to specify none." << endl << endl;
+	std::cout << "  --safe-math-wrappers <id1,id2...>: specifiy ids of wrapper functions that are necessary to avoid undefined behaviors, use 0 to specify none." << endl << endl;
@@ -294 +298 @@ static void print_advanced_help()
-	cout << "  --mark-mutable-const: mark constants that can be mutated with parentheses (disabled by default)." << endl << endl; 
+	std::cout << "  --mark-mutable-const: mark constants that can be mutated with parentheses (disabled by default)." << endl << endl; 
@@ -296 +300 @@ static void print_advanced_help()
-	cout << "  --force-non-uniform-arrays: force integer arrays to be initialized with multiple values (disabled by default)." << endl << endl; 
+	std::cout << "  --force-non-uniform-arrays: force integer arrays to be initialized with multiple values (disabled by default)." << endl << endl; 
@@ -298 +302 @@ static void print_advanced_help()
-	cout << "  --null-ptr-deref-prob <N>: allow null pointers to be dereferenced with probability N% (0 by default)." << endl << endl;
+	std::cout << "  --null-ptr-deref-prob <N>: allow null pointers to be dereferenced with probability N% (0 by default)." << endl << endl;
@@ -300 +304 @@ static void print_advanced_help()
-	cout << "  --dangling-ptr-deref-prob <N>: allow dangling pointers to be dereferenced with probability N% (0 by default)." << endl << endl; 
+	std::cout << "  --dangling-ptr-deref-prob <N>: allow dangling pointers to be dereferenced with probability N% (0 by default)." << endl << endl; 
@@ -302 +306 @@ static void print_advanced_help()
-	cout << "  --union-read-type-sensitive | --no-union-read-type-sensitive: allow | disallow reading an union field when there is no risk of "
+	std::cout << "  --union-read-type-sensitive | --no-union-read-type-sensitive: allow | disallow reading an union field when there is no risk of "
@@ -305 +309 @@ static void print_advanced_help()
-	cout << "  --max-struct-nested-level: controls the max depth of nested structs (default is 3)." << endl << endl;
+	std::cout << "  --max-struct-nested-level: controls the max depth of nested structs (default is 3)." << endl << endl;
@@ -311 +315 @@ void arg_check(int argc, int i)
-		cout << "expect arg at pos " << i << std::endl;
+		std::cout << "expect arg at pos " << i << std::endl;
@@ -433 +437 @@ main(int argc, char **argv)
-				cout << "please specify <dir>" << std::endl;
+				std::cout << "please specify <dir>" << std::endl;
@@ -496 +500 @@ main(int argc, char **argv)
-				cout << "--partial-expand needs options" << std::endl;
+				std::cout << "--partial-expand needs options" << std::endl;
@@ -663 +667 @@ main(int argc, char **argv)
-				cout<< "please specify one delta monitor!" << std::endl;
+				std::cout<< "please specify one delta monitor!" << std::endl;
@@ -675 +679 @@ main(int argc, char **argv)
-				cout<< "please specify delta output file!" << std::endl;
+				std::cout<< "please specify delta output file!" << std::endl;
@@ -687 +691 @@ main(int argc, char **argv)
-				cout<< "please specify one delta type!" << std::endl;
+				std::cout<< "please specify one delta type!" << std::endl;
@@ -847 +851 @@ main(int argc, char **argv)
-				cout << "please specify mach[x86|x86_64]" << std::endl;
+				std::cout << "please specify mach[x86|x86_64]" << std::endl;
@@ -858 +862 @@ main(int argc, char **argv)
-				cout << "please specify <dir>" << std::endl;
+				std::cout << "please specify <dir>" << std::endl;
@@ -945 +949 @@ main(int argc, char **argv)
-				cout<< "please specify name(s) of the func(s) you want to monitor" << std::endl;
+				std::cout<< "please specify name(s) of the func(s) you want to monitor" << std::endl;
@@ -962 +966 @@ main(int argc, char **argv)
-				cout<< "please specify delta output file!" << std::endl;
+				std::cout<< "please specify delta output file!" << std::endl;
@@ -974 +978 @@ main(int argc, char **argv)
-				cout<< "please pass probability configuration output file!" << std::endl;
+				std::cout<< "please pass probability configuration output file!" << std::endl;
@@ -986 +990 @@ main(int argc, char **argv)
-				cout<< "please pass probability configuration output file!" << std::endl;
+				std::cout<< "please pass probability configuration output file!" << std::endl;
@@ -998 +1002 @@ main(int argc, char **argv)
-				cout<< "please probability configuration file!" << std::endl;
+				std::cout<< "please probability configuration file!" << std::endl;
@@ -1042 +1046 @@ main(int argc, char **argv)
-				cout<< "please specify safe math wrappers in the form of id1,id2..." << std::endl;
+				std::cout<< "please specify safe math wrappers in the form of id1,id2..." << std::endl;
@@ -1164 +1168 @@ main(int argc, char **argv)
-				cout<< "please specify reduction directive file!" << std::endl;
+				std::cout<< "please specify reduction directive file!" << std::endl;
@@ -1167 +1171 @@ main(int argc, char **argv)
-			ifstream conf(filename.c_str());
+			std::ifstream conf(filename.c_str());
@@ -1169 +1173 @@ main(int argc, char **argv)
-				cout<< "can't read reduction directive file " << filename << "!" << std::endl;
+				std::cout<< "can't read reduction directive file " << filename << "!" << std::endl;
@@ -1192 +1196 @@ main(int argc, char **argv)
-		cout << "invalid option " << argv[i] << " at: "
+		std::cout << "invalid option " << argv[i] << " at: "
@@ -1199 +1203 @@ main(int argc, char **argv)
-		cout << "error: options conflict - " << CGOptions::conflict_msg() << std::endl;
+		std::cout << "error: options conflict - " << CGOptions::conflict_msg() << std::endl;
@@ -1205 +1209 @@ main(int argc, char **argv)
-		cout << "error: can't create generator!" << std::endl;
+		std::cout << "error: can't create generator!" << std::endl;
diff --git a/src/Reducer.cpp b/src/Reducer.cpp
index 3593ae2..201961c 100644
--- a/src/Reducer.cpp
+++ b/src/Reducer.cpp
@@ -91 +91 @@ Reducer::configure(void)
-	ifstream conf(fname_.c_str());
+	std::ifstream conf(fname_.c_str());
@@ -203 +203 @@ Reducer::find_stm_by_id(int stm_id)
-	map<const Block*, int>::const_iterator iter;
+	std::map<const Block*, int>::const_iterator iter;
@@ -317 +317 @@ Reducer::output_block_skeleton(const Block* blk, vector<const Block*>& work_blks
-	out << "****** block: " << blk->stm_id << " ******" << endl;
+	out << "****** block: " << blk->stm_id << " ******" << std::endl;
@@ -358 +358 @@ Reducer::output_block_skeleton(const Block* blk, vector<const Block*>& work_blks
-		out << endl;
+		out << std::endl;
@@ -897 +897 @@ Reducer::get_used_vars_and_funcs_and_labels(const Statement* stm, vector<const V
-	//stm->Output(cout);
+	//stm->Output(std::cout);
@@ -1196 +1196 @@ Reducer::add_artificial_globals(const Type* t, string name)
-	ostringstream oss;
+	std::ostringstream oss;
@@ -1391 +1391 @@ Reducer::output_expr(const Expression* e, std::ostream &out)
-		ostringstream oss;
+		std::ostringstream oss;
diff --git a/src/Reducer.h b/src/Reducer.h
index 963cf27..205b027 100644
--- a/src/Reducer.h
+++ b/src/Reducer.h
@@ -39 +39,2 @@
-using namespace std;
+using std::vector;
+using std::string;
diff --git a/src/ReducerOutputMgr.cpp b/src/ReducerOutputMgr.cpp
index 512b451..bfba54f 100644
--- a/src/ReducerOutputMgr.cpp
+++ b/src/ReducerOutputMgr.cpp
@@ -60 +60,5 @@
-using namespace std; 
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+ 
@@ -75 +79 @@ ReducerOutputMgr::get_main_out()
-		ofile_ = new ofstream(CGOptions::output_file().c_str());	
+		ofile_ = new std::ofstream(CGOptions::output_file().c_str());	
@@ -112 +116 @@ ReducerOutputMgr::OutputHeader(int argc, char *argv[], unsigned long /*seed*/)
-	out << "#include \"csmith.h\"" << endl << endl;
+	out << "#include \"csmith.h\"\n\n";
@@ -125 +129 @@ ReducerOutputMgr::output_var(const Variable* v, std::ostream &out, int indent)
-		out << " = " << init << ";" << endl;
+		out << " = " << init << ";" << std::endl;
@@ -554 +558 @@ ReducerOutputMgr::output_alt_exprs(const Statement* stm, std::ostream &out, int
-		ostringstream oss; 
+		std::ostringstream oss; 
@@ -639 +643 @@ ReducerOutputMgr::output_reduced_stm(const Statement* stm, std::ostream &out, in
-					ostringstream oss; 
+					std::ostringstream oss; 
@@ -776 +780 @@ ReducerOutputMgr::rewrite_func_call(const Statement* stm, const FunctionInvocati
-	ostringstream oss;
+	std::ostringstream oss;
@@ -891 +895 @@ ReducerOutputMgr::output_write_var_values(string title, const Statement* stm, st
-			ostringstream oss;
+			std::ostringstream oss;
@@ -933 +937 @@ ReducerOutputMgr::output_global_values(string header, std::ostream& out, int ind
-			ostringstream oss; 
+		    std::ostringstream oss; 
diff --git a/src/ReducerOutputMgr.h b/src/ReducerOutputMgr.h
index 9fd1f4a..cd0fd50 100644
--- a/src/ReducerOutputMgr.h
+++ b/src/ReducerOutputMgr.h
@@ -50,2 +49,0 @@ class FunctionInvocationBinary;
-using namespace std;
-
@@ -61 +59 @@ public:
-	void rewrite_func_call(const Statement* stm, const FunctionInvocation* invoke, string id, std::ostream& out, int indent);
+	void rewrite_func_call(const Statement* stm, const FunctionInvocation* invoke, std::string id, std::ostream& out, int indent);
@@ -65 +63 @@ public:
-	void output_write_var_values(string title, const Statement* stm, std::ostream &out, FactMgr* fm, int indent, bool cover_block_writes=false);
+	void output_write_var_values(std::string title, const Statement* stm, std::ostream &out, FactMgr* fm, int indent, bool cover_block_writes=false);
@@ -67,2 +65,2 @@ public:
-	void output_global_values(string header, std::ostream& out, int indent);
-	void output_tail(ostream& out);
+	void output_global_values(std::string header, std::ostream& out, int indent);
+	void output_tail(std::ostream& out);
@@ -71 +69 @@ public:
-	void output_vars(const vector<Variable*> &vars, std::ostream &out, int indent);
+	void output_vars(const std::vector<Variable*> &vars, std::ostream &out, int indent);
@@ -86 +84 @@ public:
-	void output_artificial_globals(ostream& out);
+	void output_artificial_globals(std::ostream& out);
@@ -88,2 +86,2 @@ public:
-	virtual void OutputStructUnions(ostream& out);
-	void OutputGlobals(ostream& out);
+	virtual void OutputStructUnions(std::ostream& out);
+	void OutputGlobals(std::ostream& out);
@@ -93 +91 @@ private:
-	void limit_binarys(vector<const FunctionInvocationBinary*>& binarys, vector<int>& ids);
+	void limit_binarys(std::vector<const FunctionInvocationBinary*>& binarys, std::vector<int>& ids);
diff --git a/src/SafeOpFlags.cpp b/src/SafeOpFlags.cpp
index f65e9ad..c00bfd9 100644
--- a/src/SafeOpFlags.cpp
+++ b/src/SafeOpFlags.cpp
@@ -42 +42,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -227 +231 @@ SafeOpFlags::to_string(enum eBinaryOps op) const
-	ostringstream oss;
+	std::ostringstream oss;
@@ -245 +249 @@ SafeOpFlags::to_string(enum eUnaryOps op) const
-	ostringstream oss;
+	std::ostringstream oss;
diff --git a/src/SequenceLineParser.h b/src/SequenceLineParser.h
index 9d2d3f8..f773df6 100644
--- a/src/SequenceLineParser.h
+++ b/src/SequenceLineParser.h
@@ -37 +37,2 @@
-using namespace std;
+using std::vector;
+using std::string;
@@ -92 +93 @@ SequenceLineParser<Container>::str2int(const std::string &s)
-	stringstream ss(s);
+	std::stringstream ss(s);
diff --git a/src/SimpleDeltaRndNumGenerator.cpp b/src/SimpleDeltaRndNumGenerator.cpp
index 82dc5b0..74ebe40 100644
--- a/src/SimpleDeltaRndNumGenerator.cpp
+++ b/src/SimpleDeltaRndNumGenerator.cpp
@@ -216 +216 @@ void
-SimpleDeltaRndNumGenerator::OutputStatistics(ostream &out)
+SimpleDeltaRndNumGenerator::OutputStatistics(std::ostream &out)
diff --git a/src/SimpleDeltaRndNumGenerator.h b/src/SimpleDeltaRndNumGenerator.h
index 9e1b9eb..c79c2cb 100644
--- a/src/SimpleDeltaRndNumGenerator.h
+++ b/src/SimpleDeltaRndNumGenerator.h
@@ -50 +50 @@ public:
-	static void OutputStatistics(ostream &out);
+	static void OutputStatistics(std::ostream &out);
diff --git a/src/SimpleDeltaSequence.cpp b/src/SimpleDeltaSequence.cpp
index 827ca75..d372d69 100644
--- a/src/SimpleDeltaSequence.cpp
+++ b/src/SimpleDeltaSequence.cpp
@@ -40 +40,3 @@
-using namespace std;
+using std::vector;
+using std::ostream;
+
@@ -122 +124 @@ SimpleDeltaSequence::empty_line(const std::string &line)
-	return (found == string::npos);
+	return (found == std::string::npos);
@@ -132 +134 @@ SimpleDeltaSequence::init_sequence()
-	ifstream seqf(fname.c_str());
+	std::ifstream seqf(fname.c_str());
diff --git a/src/SplatExtension.cpp b/src/SplatExtension.cpp
index 9dbe713..57b585e 100644
--- a/src/SplatExtension.cpp
+++ b/src/SplatExtension.cpp
@@ -36 +36,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/Statement.cpp b/src/Statement.cpp
index 5de652f..ee233af 100644
--- a/src/Statement.cpp
+++ b/src/Statement.cpp
@@ -83 +83,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -566 +570 @@ Statement::shortcut_analysis(vector<const Fact*>& inputs, CGContext& cg_context)
-		//cg_context.get_effect_context().Output(cout);
+		//cg_context.get_effect_context().Output(std::cout);
@@ -568 +572 @@ Statement::shortcut_analysis(vector<const Fact*>& inputs, CGContext& cg_context)
-		//fm->map_stm_effect[this].Output(cout);
+		//fm->map_stm_effect[this].Output(std::cout);
@@ -636 +640 @@ Statement::stm_visit_facts(vector<const Fact*>& inputs, CGContext& cg_context) c
-	//	Output(cout, fm);
+	//	Output(std::cout, fm);
@@ -903 +907 @@ Statement::post_creation_analysis(vector<const Fact*>& pre_facts, const Effect&
-					((const StatementAssign*)this)->get_rhs()->indented_output(cout, 0);
+					((const StatementAssign*)this)->get_rhs()->indented_output(std::cout, 0);
@@ -905,2 +909,2 @@ Statement::post_creation_analysis(vector<const Fact*>& pre_facts, const Effect&
-				cout << endl;
-				Output(cout, fm);*/
+				std::cout << endl;
+				Output(std::cout, fm);*/
diff --git a/src/Statement.h b/src/Statement.h
index 8a5aee7..e7a4cdd 100644
--- a/src/Statement.h
+++ b/src/Statement.h
@@ -46 +46,2 @@
-using namespace std;
+using std::vector;
+using std::string;
diff --git a/src/StatementArrayOp.cpp b/src/StatementArrayOp.cpp
index f4ae24f..dbe1e1b 100644
--- a/src/StatementArrayOp.cpp
+++ b/src/StatementArrayOp.cpp
@@ -56 +56,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/StatementAssign.cpp b/src/StatementAssign.cpp
index cc24819..eaa9961 100644
--- a/src/StatementAssign.cpp
+++ b/src/StatementAssign.cpp
@@ -58 +58,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/StatementBreak.cpp b/src/StatementBreak.cpp
index ca0072e..c4fbc6c 100644
--- a/src/StatementBreak.cpp
+++ b/src/StatementBreak.cpp
@@ -48 +48,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/StatementContinue.cpp b/src/StatementContinue.cpp
index aad41ae..53638f6 100644
--- a/src/StatementContinue.cpp
+++ b/src/StatementContinue.cpp
@@ -47 +47,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/StatementExpr.cpp b/src/StatementExpr.cpp
index 916f920..f17791a 100644
--- a/src/StatementExpr.cpp
+++ b/src/StatementExpr.cpp
@@ -43 +43,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/StatementFor.cpp b/src/StatementFor.cpp
index a2fbfb2..2913b03 100644
--- a/src/StatementFor.cpp
+++ b/src/StatementFor.cpp
@@ -58 +58,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/StatementGoto.cpp b/src/StatementGoto.cpp
index 7de2b56..b2c1c8a 100644
--- a/src/StatementGoto.cpp
+++ b/src/StatementGoto.cpp
@@ -52 +52,2 @@
-using namespace std;
+using std::vector;
+using std::ostream;
@@ -54 +55,2 @@ using namespace std;
-std::map<const Statement*, string> StatementGoto::stm_labels;
+
+std::map<const Statement*, std::string> StatementGoto::stm_labels;
@@ -163 +165 @@ StatementGoto::make_random(CGContext &cg_context)
-				map<const Statement*, FactVec> facts_in_copy, facts_out_copy;
+				std::map<const Statement*, FactVec> facts_in_copy, facts_out_copy;
@@ -401 +403 @@ StatementGoto::visit_facts(vector<const Fact*>& inputs, CGContext& cg_context) c
-			//cout << endl;
+			//std::cout << std::endl;
diff --git a/src/StatementGoto.h b/src/StatementGoto.h
index 3927c4a..2ff9626 100644
--- a/src/StatementGoto.h
+++ b/src/StatementGoto.h
@@ -38 +38,2 @@
-using namespace std;
+using std::vector;
+using std::string;
diff --git a/src/StatementIf.cpp b/src/StatementIf.cpp
index 629985d..0cd5331 100644
--- a/src/StatementIf.cpp
+++ b/src/StatementIf.cpp
@@ -48 +48,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -79 +83 @@ StatementIf::make_random(CGContext &cg_context)
-			//	expr->indented_output(cout, 0);
+			//	expr->indented_output(std::cout, 0);
diff --git a/src/StatementReturn.cpp b/src/StatementReturn.cpp
index 0bc0240..0afe0bd 100644
--- a/src/StatementReturn.cpp
+++ b/src/StatementReturn.cpp
@@ -45 +45,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 0a1f1e8..e825790 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -35 +35,4 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::ostream;
+
@@ -175 +178 @@ StringUtils::str2int(const std::string &s)
-	stringstream ss(s);
+	std::stringstream ss(s);
@@ -188 +191 @@ StringUtils::int2str(int i)
-	ostringstream oss;
+	std::ostringstream oss;
@@ -212 +215 @@ StringUtils::str2longlong(const std::string &s)
-		stringstream ss(s);
+		std::stringstream ss(s);
@@ -221 +224 @@ StringUtils::longlong2str(INT64 i)
-	ostringstream oss;
+	std::ostringstream oss;
diff --git a/src/StringUtils.h b/src/StringUtils.h
index df543b3..408c6e5 100644
--- a/src/StringUtils.h
+++ b/src/StringUtils.h
@@ -36 +36,2 @@
-using namespace std;
+using std::vector;
+using std::string;
diff --git a/src/Type.cpp b/src/Type.cpp
index f640d71..d9150c1 100644
--- a/src/Type.cpp
+++ b/src/Type.cpp
@@ -54 +54,4 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::ostream;
+
@@ -1517 +1520 @@ Type::get_int_subfield_names(string prefix, vector<string>& names, const vector<
-			ostringstream oss;
+			std::ostringstream oss;
@@ -1562 +1565 @@ Type::get_type_sizeof_string(std::string &s) const
-	ostringstream ss;
+	std::ostringstream ss;
diff --git a/src/Type.h b/src/Type.h
index 9b159a4..3fdd9b5 100644
--- a/src/Type.h
+++ b/src/Type.h
@@ -52 +52,2 @@ template <class Name> class Enumerator;
-using namespace std;
+using std::vector;
+using std::string;
diff --git a/src/Variable.cpp b/src/Variable.cpp
index 098205e..416b58f 100644
--- a/src/Variable.cpp
+++ b/src/Variable.cpp
@@ -69 +69,4 @@
-using namespace std; 
+using std::vector;
+using std::string;
+using std::ostream;
+ 
@@ -337 +340 @@ void Variable::create_field_vars(const Type *type)
-		ostringstream ss;
+		std::ostringstream ss;
@@ -638 +641 @@ Variable::deputy_annotation(void) const
-				ostringstream oss;
+				std::ostringstream oss;
@@ -655 +658 @@ Variable::deputy_annotation(void) const
-			//	ostringstream oss;
+			//	std::ostringstream oss;
@@ -1027 +1030 @@ Variable::hash(std::ostream& out) const
-			out << ", \"" << name << "\", print_hash_value);" << endl;
+			out << ", \"" << name << "\", print_hash_value);" << std::endl;
@@ -1032 +1035 @@ Variable::hash(std::ostream& out) const
-			out << ";" << endl;
+			out << ";" << std::endl;
@@ -1078 +1081 @@ Variable::to_string(void) const
-		ostringstream oss;
+		std::ostringstream oss;
@@ -1090 +1093 @@ Variable::output_runtime_value(ostream &out, string prefix, string suffix, int i
-	ostringstream oss;
+	std::ostringstream oss;
@@ -1115 +1118 @@ Variable::output_runtime_value(ostream &out, string prefix, string suffix, int i
-		out << "printf(\"" << prefix << "\");" << endl;
+		out << "printf(\"" << prefix << "\");" << std::endl;
@@ -1333 +1336 @@ Variable::match_var_name(const string& vname) const
-		ostringstream oss;
+		std::ostringstream oss;
diff --git a/src/Variable.h b/src/Variable.h
index 40cbf47..baf693c 100644
--- a/src/Variable.h
+++ b/src/Variable.h
@@ -48 +48,2 @@
-using namespace std;
+using std::vector;
+using std::string;
@@ -124,4 +125,4 @@ public:
-	int output_runtime_value(ostream &out, string prefix, string suffix, int indent, bool multi_lines=false) const;
-	int output_addressable_name(ostream &out, int indent) const;
-	int output_volatile_address(ostream &out, int indent, const string &fp_string, vector<string> &seen_names) const;
-	int output_volatile_fprintf(ostream &out, int indent, const string &name, 
+	int output_runtime_value(std::ostream &out, string prefix, string suffix, int indent, bool multi_lines=false) const;
+	int output_addressable_name(std::ostream &out, int indent) const;
+	int output_volatile_address(std::ostream &out, int indent, const string &fp_string, vector<string> &seen_names) const;
+	int output_volatile_fprintf(std::ostream &out, int indent, const string &name, 
@@ -131 +132 @@ public:
-	int output_value_dump(ostream &out, string prefix, int indent) const;
+	int output_value_dump(std::ostream &out, string prefix, int indent) const;
diff --git a/src/VariableSelector.cpp b/src/VariableSelector.cpp
index 6964bef..dd7a93f 100644
--- a/src/VariableSelector.cpp
+++ b/src/VariableSelector.cpp
@@ -65 +65,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::ostream;
@@ -1359 +1361 @@ VariableSelector::itemize_array(CGContext& cg_context, const ArrayVariable* av)
-		map<const Variable*, unsigned int>::iterator iter;
+		std::map<const Variable*, unsigned int>::iterator iter;
diff --git a/src/VariableSelector.h b/src/VariableSelector.h
index 9482885..15e980b 100644
--- a/src/VariableSelector.h
+++ b/src/VariableSelector.h
@@ -37 +37,3 @@
-using namespace std;
+using std::vector;
+using std::string;
+
diff --git a/src/VectorFilter.cpp b/src/VectorFilter.cpp
index cf01b63..7b0e22b 100644
--- a/src/VectorFilter.cpp
+++ b/src/VectorFilter.cpp
@@ -36 +36,5 @@
-using namespace std;
+using std::vector;
+using std::string;
+using std::endl;
+using std::ostream;
+
@@ -97 +101 @@ VectorFilter::lookup(int v) const
-}
\ No newline at end of file
+}
diff --git a/src/csmith.vcxproj b/src/csmith.vcxproj
index bd78e3c..158c426 100644
--- a/src/csmith.vcxproj
+++ b/src/csmith.vcxproj
@@ -475 +475 @@
-</Project>
\ No newline at end of file
+</Project>
diff --git a/src/util.cpp b/src/util.cpp
index 37ec430..63aad75 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -42,2 +42 @@
-
-using namespace std; 
+ 
@@ -57 +56 @@ reset_gensym()
-string
+std::string
@@ -60 +59 @@ gensym(const char* basename)
-	ostringstream ss; //(basename, ios_base::ate); somehow this yields weird result on windows
+	std::ostringstream ss; //(basename, ios_base::ate); somehow this yields weird result on windows
@@ -72 +71 @@ gensym(const string& basename)
-	ostringstream ss; //(basename, ios_base::ate);
+	std::ostringstream ss; //(basename, ios_base::ate);
@@ -82 +81 @@ gensym(const string& basename)
-vector<intvec> permute(intvec in)
+std::vector<intvec> permute(intvec in)
-- 
1.7.7.3