I'm getting back into C++ after a long hiatus (they didn't have
namespaces back then).
I know this question is completely subjective, but I'd be interested in
hearing which is
the "better" style and what the pros and cons are (I'm using cout as
example, but it really
applies to any similar construct):
1) using std::cout;
cout << "This is a test";
2) std::cout << "This is a test";
The difference being prefixing every cout with 'std' or declaring it
ahead of time. The second
method could be used if cout existed in more than one spot, but how
often is that an issue?
I've seen both methods in code, but I'm seeing #2 a lot more frequently.
namespaces back then).
I know this question is completely subjective, but I'd be interested in
hearing which is
the "better" style and what the pros and cons are (I'm using cout as
example, but it really
applies to any similar construct):
1) using std::cout;
cout << "This is a test";
2) std::cout << "This is a test";
The difference being prefixing every cout with 'std' or declaring it
ahead of time. The second
method could be used if cout existed in more than one spot, but how
often is that an issue?
I've seen both methods in code, but I'm seeing #2 a lot more frequently.
Comment