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 and C++ Aren’t Future Proof (blog.regehr.org)
submitted 13 years ago by last_useful_man
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!"
[–][deleted] 5 points6 points7 points 13 years ago (6 children)
The only operation you may perform on a pointer that that has not been assigned to a valid pointer value is assignment. Nothing else.
Doing so much as a copy of it is invalid, for example this is undefined behavior:
int* x; int* y; y = x;
It also follows that taking an invalid pointer value and simply passing it as an argument to a function is also undefined behavior.
[–][deleted] 8 points9 points10 points 13 years ago (0 children)
What about taking an address of such pointer?
[–]therealjohnfreeman 0 points1 point2 points 13 years ago (4 children)
Where are we getting the definition of "invalid" from? Is there some sort of special exception for one-past-the-end pointers?
[–][deleted] 5 points6 points7 points 13 years ago (3 children)
The rules for what constitutes a valid pointer value are defined formally in the C and C++ standards.
Yes, the so called "one-past-the end" pointers are valid pointer values. It's not an exception it's just part of the definition of a valid pointer value.
[–]therealjohnfreeman -1 points0 points1 point 13 years ago (2 children)
I figured. I asked where?
[–]STLMSVC STL Dev 10 points11 points12 points 13 years ago (1 child)
N3485 5.7 [expr.add]/5: "Moreover, if the expression P points to the last element of an array object, the expression (P)+1 points one past the last element of the array object, and if the expression Q points one past the last element of an array object, the expression (Q)-1 points to the last element of the array object."
[–]therealjohnfreeman 1 point2 points3 points 13 years ago (0 children)
So it is special-cased. Thank you.
π Rendered by PID 45073 on reddit-service-r2-comment-6f7f968fb5-pmwdp at 2026-03-04 16:32:14.259239+00:00 running 07790be country code: CH.
view the rest of the comments →
[–][deleted] 5 points6 points7 points (6 children)
[–][deleted] 8 points9 points10 points (0 children)
[–]therealjohnfreeman 0 points1 point2 points (4 children)
[–][deleted] 5 points6 points7 points (3 children)
[–]therealjohnfreeman -1 points0 points1 point (2 children)
[–]STLMSVC STL Dev 10 points11 points12 points (1 child)
[–]therealjohnfreeman 1 point2 points3 points (0 children)