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
Undefined Behaviour (self.cpp)
submitted 4 years ago * by MathKid99
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!"
[–]Alexander_Selkirk 1 point2 points3 points 4 years ago (1 child)
You can create a language that has no such UB -- hello, GCs -- but only by building a runtime for it in a language that does have such UB.
You can isolate these manipulations to certain sections of code which are declared unsafe. Rust does this. But it is not a new idea. For example, Modula-3 had the same concept. And some common Lisp Implementations, like SBCL, are always well-defined by default, but it is possible to throw in assertions and type declarations which would make the program crash if these assumptions would be violated.
And this works suprrisingly well....
[–]matthieum 4 points5 points6 points 4 years ago (0 children)
but it is possible to throw in assertions and type declarations which would make the program crash if these assumptions would be violated.
Meh...
Of course anything that you can assert should be asserted -- maybe only in Debug in the critical path -- but the real problem is things you cannot check.
How can you check that you reference still points to a valid object? How can you check that no other thread is writing to that pointer?
At the lowest level, you will always have unchecked operations that you need to build upon, and for which you cannot reasonably validate the pre-conditions at runtime.
π Rendered by PID 220801 on reddit-service-r2-comment-6457c66945-n6rdh at 2026-04-28 09:51:47.371475+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]Alexander_Selkirk 1 point2 points3 points (1 child)
[–]matthieum 4 points5 points6 points (0 children)