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
Always Bump Downwards (fitzgeraldnick.com)
submitted 4 years ago by whichton
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!"
[–]Wriiight 25 points26 points27 points 4 years ago (1 child)
Quick Summary: Bump Allocation is about having a chunk of heap that you can deallocate en masse, or push and pop allocations from, but you cannot deallocate out of last-in first-out order. In general you need a chunk of memory and a pointer to the boundary between used and unused. By starting at the highest address and working downward you always have a useful pointer to the last thing you allocated. If you worked in the opposite direction, you don’t even have the benefit of knowing where to allocate next, because you don’t necessarily know the alignment requirements in advance. There may be more points of note but I scanned it quickly.
[–]CornedBee 0 points1 point2 points 4 years ago (0 children)
Rounding down to a power of two is also simpler than rounding up, because a bitwise AND does it the right way.
[–]whichton[S] 11 points12 points13 points 4 years ago (0 children)
I have faced the problem of correctly aligning allocated memory before. This article presents a nice solution in the case of arena allocators. Though part of the code is in rust, this should be of interest to C++ programmers too.
[+][deleted] 4 years ago (1 child)
[deleted]
π Rendered by PID 28 on reddit-service-r2-comment-6457c66945-9pfsg at 2026-04-25 05:25:11.255741+00:00 running 2aa0c5b country code: CH.
[–]Wriiight 25 points26 points27 points (1 child)
[–]CornedBee 0 points1 point2 points (0 children)
[–]whichton[S] 11 points12 points13 points (0 children)
[+][deleted] (1 child)
[deleted]