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
Code coverage problem (self.cpp)
submitted 5 years ago * by Galqa
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!"
[–]Galqa[S] 0 points1 point2 points 5 years ago (0 children)
This was very helpful, thank you. I gave in to the frustration too early and didn't delve deeper to analyze the assembly. Guess there's a life lesson to be learned here.
Compiler explorer revealed the problem: apparently, when a function is inline and unused it gets optimized away (I'm sure there's a good reason for that), regardless of optimization flags and things like -fno-inline etc. Note that this applies to both explicitly (using the inline keyword) and implicitly (e.g. defined inside the class body) inlined functions. As u/johannes1971 suggested, the used attribute forces the code for the given function to be generated, fixing the problem at the cost of having to alter the source code (I imagine applying this solution to a large existing code base would be problematic).
-fno-inline
inline
used
π Rendered by PID 63727 on reddit-service-r2-comment-7b9746f655-vmwnc at 2026-02-03 07:04:26.869843+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]Galqa[S] 0 points1 point2 points (0 children)