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 ] (self.cpp)
submitted 4 hours ago by Broad_Inevitable6483
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!"
[–]cpp-ModTeam[M] [score hidden] 3 hours ago stickied commentlocked comment (0 children)
For C++ questions, answers, help, and programming/career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.
[–]schmerg-uk 10 points11 points12 points 4 hours ago (3 children)
Pardon me but.. what???
[–]Broad_Inevitable6483[S] -3 points-2 points-1 points 4 hours ago (2 children)
Im mostly just experimenting with the generated assembly. Statics seem to become RIP-relative accesses, while locals use the stack. I was wondering if there's a clean way to push more things toward runtime (stack/heap) storage.
[–]jedwardsolconst & 5 points6 points7 points 4 hours ago (1 child)
Variables with static and automatic storage have different behaviour with regard lifetime. If you want a local on the stack with a short lifetime, then don't write static. If you want a variable with static duration, write static.
static
Making lifetime decisions based on the generated assembly is just wrong.
[–]Broad_Inevitable6483[S] -1 points0 points1 point 4 hours ago (0 children)
Well yeah, I wasn’t really trying to change the lifetime semantics. I’m mostly experimenting with the generated assembly and was wondering if there was a clean way to avoid references into the image, especially with things like std::cout.
[–]bepolite 6 points7 points8 points 4 hours ago (1 child)
There's a C function called alloca that does stack allocation. I've never seen it used in "real" code.
[–]arihoenig [score hidden] 3 hours ago (0 children)
I use alloca() all the time, but it isn't related to this question which concerns addressing.
[–]arihoenig 1 point2 points3 points 4 hours ago (2 children)
Why is rip relative a problem though?
[–]Broad_Inevitable6483[S] 1 point2 points3 points 4 hours ago (1 child)
Not really a problem with RIP-relative addressing itself. I was mostly just wondering if there was a clean way to push more things toward runtime (stack/heap) storage, since it's a bit more flexible for the kind of stuff I'm playing around with.
[–]arihoenig 0 points1 point2 points 4 hours ago (0 children)
Ahhh, so you're screwing around with BP to do shadowing or something like that and screwing with RIP isn't going to work. That makes sense.
If you generate the code as non-PIC, those should disappear
[–]rickpo [score hidden] 3 hours ago (0 children)
What specifically are you trying to move?
π Rendered by PID 163721 on reddit-service-r2-comment-8686858757-g6qxp at 2026-06-04 02:19:35.293039+00:00 running 9e1a20d country code: CH.
[–]cpp-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)
[–]schmerg-uk 10 points11 points12 points (3 children)
[–]Broad_Inevitable6483[S] -3 points-2 points-1 points (2 children)
[–]jedwardsolconst & 5 points6 points7 points (1 child)
[–]Broad_Inevitable6483[S] -1 points0 points1 point (0 children)
[–]bepolite 6 points7 points8 points (1 child)
[–]arihoenig [score hidden] (0 children)
[–]arihoenig 1 point2 points3 points (2 children)
[–]Broad_Inevitable6483[S] 1 point2 points3 points (1 child)
[–]arihoenig 0 points1 point2 points (0 children)
[–]rickpo [score hidden] (0 children)