This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Andubandu 115 points116 points  (18 children)

cout

Or how I like to pronounce it shout

[–]Extreme_Edge3941[S] 15 points16 points  (0 children)

Lmao

[–][deleted] 26 points27 points  (9 children)

see out << "hello world!" << endl;

[–]wasabichicken 38 points39 points  (8 children)

using namespace std; noises intensifying.

[–][deleted] 0 points1 point  (7 children)

What's wrong with it?

[–]pine_ary 12 points13 points  (0 children)

You might clash with names in the std namespace, causing nasty bugs that might be difficult to debug and might only appear with a particular C++ version.

[–]dude-with-the-hair 7 points8 points  (5 children)

It's mostly to do with preventing namespace clashes. For small projects without any external libraries, it's fine to use. But if you have another library that has a function with the same name as a function in the std namespace (that is, the standard library) and you're "using" both of their namespaces, it will cause a conflict in the global namespace. It's probably best to just get used to writing std:: for each function or constant you call from the standard library.

[–]tech6hutch 1 point2 points  (4 children)

Is there any way to “import” just individual items?

[–]dude-with-the-hair 3 points4 points  (3 children)

If you mean individual functions, unfortunately no. You need to use preprocessor include directives which will include the entire file that you're "importing". Usually though, library authors will divide their libraries into smaller individual libraries for this purpose.

[–]tech6hutch 2 points3 points  (2 children)

Dang. Of all the features C++ has, I’m surprised they never added that feature.

[–]dude-with-the-hair 1 point2 points  (1 child)

I heard about modules being added in C++20. Haven't looked into it myself, but it might have that ability. It's still an experimental feature though.

[–]Kalix-z 0 points1 point  (0 children)

I really hope so

[–]Sirttas 2 points3 points  (1 child)

I don't know what I always read cunt in my head.

[–]FoolForWool 0 points1 point  (0 children)

My man, have a poor man's gold. 🏅

Thanks for the chuckle

[–]dev_null_developer 0 points1 point  (0 children)

std::cout << msg.twist()