Jump to content
  • Advertisement
Sign in to follow this  
Bombario

using namespace std -- Does that make the exe huge?

This topic is 4976 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

(obviously talking about C++) Should I just say using std::whatever instead of using namespace std;? I made a really small text-based game, and it was like 500k...I figured it'd be under 50, so is it because I said using namespace std? Also, I can just throw those using std::whatever declarations in a header, right?

Share this post


Link to post
Share on other sites
Advertisement
it shouldn't matter, they're going to be linked the same way anyway(and, yes, it's ok use the std:: in headers)

Share this post


Link to post
Share on other sites
using namespace std; is a compile-time resolution tool. It has no impact on linking or binary file size. Your large file size is most likely due to the size of the statically-linked iostream library.

Share this post


Link to post
Share on other sites
Quote:
Original post by Bombario
Should I just say using std::whatever instead of using namespace std;?

In headers, you should preferably fully qualify all the names (std::vector, std::string, et cetera), and not use any using directives. The less you dump into the global namespace, the better. (using bla::whatever over using namespace bla is of course less bad, but as others have pointed out, the reasons have nothing to do with the size of the finished executable.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!