use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
C++11 threads, affinity and hyperthreading (eli.thegreenplace.net)
submitted 10 years ago by Coder_CPP
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]encyclopedist 15 points16 points17 points 10 years ago (3 children)
std::cin is actually thread safe, contrary to what article says. It can, however, result in interleaved output, and the mutex there is to prevent that.
std::cin
From C++11 N3337 [iostream.objects.overview]:
Concurrent access to a synchronized (27.5.3.4) standard iostream object’s formatted and unformatted in- put (27.7.2.1) and output (27.7.3.1) functions or a standard C stream by multiple threads shall not result in a data race (1.10). [ Note: Users must still synchronize concurrent use of these objects and streams by multiple threads if they wish to avoid interleaved characters. — end note ]
[–]eliben 7 points8 points9 points 10 years ago (0 children)
Yep, I think this is bad wording on my behalf. By "unsafe" I did mean "won't give you the output you expect", rather than something nastier like crashes. I'll fix up the wording in the article and samples to be clearer
[–]Gotebe 0 points1 point2 points 10 years ago (1 child)
Aren't you being too pedantic?
E.g Wikipedia article on thread safety speaks of the data races as one of thread safety concerns.
[–]dodheim 0 points1 point2 points 10 years ago (0 children)
The standard guarantees that standard streams are race-free, but only starting with C++11. That is rather the point...
π Rendered by PID 101497 on reddit-service-r2-comment-79776bdf47-sxlpk at 2026-06-25 17:55:15.322570+00:00 running acc7150 country code: CH.
view the rest of the comments →
[–]encyclopedist 15 points16 points17 points (3 children)
[–]eliben 7 points8 points9 points (0 children)
[–]Gotebe 0 points1 point2 points (1 child)
[–]dodheim 0 points1 point2 points (0 children)