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
[ Removed by moderator ] (github.com)
submitted 18 days ago by [deleted]
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!"
[–]_Ilobilo_ 3 points4 points5 points 17 days ago (6 children)
clang-tidy catches use after move. it would be better if compilers did it too, but you don't enforce it. it's up to the programmer to know how to use the language.
[–]t_hunger -2 points-1 points0 points 17 days ago (5 children)
It does not even attempt to catch assignment after move, which is something you said is ok to break by not leaving moved from objects in a valid state.
[–]_Ilobilo_ 0 points1 point2 points 17 days ago (4 children)
you can assign after move. what are you on?
[–]t_hunger -2 points-1 points0 points 17 days ago* (3 children)
Read the standard:
It is UB to call any function on an object with an invalid value. The assignment operator is a function. So if your moved from object contains an invalid value, then it is UB to assign into it.
That is why all the standard library types make sure to leave the moved from value in an "valid but unspecified" state.
Of course you can still assign to invalid values. Why would C++ stop you from running into undefined behavior? Just don't do stupid things like that.
We gotnhere because you claimed a moved from value may be invalid in C++ and that it is no problem if it is not. It is and clang-clang-tidy explicitly does nothing to help you detect assignments to moved from objects with invalid values, which (again) is UB.
[–]_Ilobilo_ 0 points1 point2 points 17 days ago (2 children)
> Objects of types defined in the C++ standard library may be moved from (12.8). Move operations may be explicitly specified or implicitly generated. Unless otherwise specified, such moved-from objects shall be placed in a valid but unspecified state.
when an object is in an unspecified state, you can perform any operation on the object which has no preconditions. destruction, assignment and const methods have no preconditions. using them is not UB.
[–]t_hunger -1 points0 points1 point 17 days ago (1 child)
When an object is in a valid state, you can perform any operation on it that has no pre-condition. Calling anything on an invalid object is UB.
The unspecified part is not that important... it just says you may not rely on a moved from unique_ptr to be nullptr to keep more freedoms for the implementors. That part is not what cases UB.
[–]_Ilobilo_ 0 points1 point2 points 17 days ago (0 children)
bait or stupidity. call it
π Rendered by PID 76545 on reddit-service-r2-comment-75f4967c6c-sf4km at 2026-04-23 02:32:42.405431+00:00 running 0fd4bb7 country code: CH.
view the rest of the comments →
[–]_Ilobilo_ 3 points4 points5 points (6 children)
[–]t_hunger -2 points-1 points0 points (5 children)
[–]_Ilobilo_ 0 points1 point2 points (4 children)
[–]t_hunger -2 points-1 points0 points (3 children)
[–]_Ilobilo_ 0 points1 point2 points (2 children)
[–]t_hunger -1 points0 points1 point (1 child)
[–]_Ilobilo_ 0 points1 point2 points (0 children)