User forums > Using Code::Blocks

Shortcuts for including C++ library files and namespaces?

(1/1)

igottamarlin:
I'm a noob to C++ and programming in general, but I just made a header file with these two lines:

#include <iostream>
using namespace std;

Is that a bad habit and will I ever have to stop doing that? I could add stuff to it, but I feel like at some point it will become detrimental to the user of the program. Does anyone else do that?

stahta01:

--- Quote from: igottamarlin on July 10, 2017, 03:59:16 pm ---I'm a noob to C++ and programming in general, but I just made a header file with these two lines:

#include <iostream>
using namespace std;

Is that a bad habit and will I ever have to stop doing that? I could add stuff to it, but I feel like at some point it will become detrimental to the user of the program. Does anyone else do that?

--- End quote ---

Read the rules http://forums.codeblocks.org/index.php/topic,9996.0.html

Then post your off topic question on a website like https://cboard.cprogramming.com/forum.php

Tim S.

sodev:

--- Quote from: igottamarlin on July 10, 2017, 03:59:16 pm ---using namespace std;

--- End quote ---
Everyone who is writing this in an implementation file should be shot instantly, everyone who is writing this in a header file should be shot twice :D. For the reasoning behind this please check your favorite programming style guide ;).

Navigation

[0] Message Index

Go to full version