Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: igottamarlin on July 10, 2017, 03:59:16 pm

Title: Shortcuts for including C++ library files and namespaces?
Post by: 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?
Title: Re: Shortcuts for including C++ library files and namespaces?
Post by: stahta01 on July 10, 2017, 05:43:45 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?

Read the rules http://forums.codeblocks.org/index.php/topic,9996.0.html (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 (https://cboard.cprogramming.com/forum.php)

Tim S.
Title: Re: Shortcuts for including C++ library files and namespaces?
Post by: sodev on July 10, 2017, 07:52:10 pm
using namespace std;
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 ;).