Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function arguments (c++)
#11
Quote:Also, the "using namespace std" is bad practice. This is because some of the functions in other namespaces (especially vector classes)clash with the stuff in std (but that doesn't actually happen that often).
What 'other namespaces' are you referring to? The entire standard library (including std::vector) is defined in the std namespace - this is why you refer to class vector as std::vector, or simply vector within the scope of a using statement, such as using std::vector;. std::vector does not have its own namespace, and if there were name collisions within the standard library, using namespace std; probably wouldn't compile, or worse, work unexpectedly.

Quote:But you don't really need to worry about that yet, if you're just beginning.
You should always be aware of what is and what isn't in scope at a particular location in your program. Otherwise, you might as well be programming in QB.
stylin:
Reply
#12
Excellent commenting!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)