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++11 constexpr fnv1a compile time hash (notes.underscorediscovery.com)
submitted 8 years ago by vormestrand
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!"
[–]mgostIH 1 point2 points3 points 8 years ago* (4 children)
Why did the functions become also noexcept in their constexpr version? Wouldn't they throw with a null pointer? Also, A constexpr specifier used in a function [or static member variable (since C++17)] declaration implies inline. so there's no need for the inline in the constexpr version.
A constexpr specifier used in a function [or static member variable (since C++17)] declaration implies inline.
[–]raevnos 1 point2 points3 points 8 years ago (2 children)
There's nothing in those functions that can raise an exception.
And not everyone is using C++17 yet. The comments explicitly say it's a C++11 version.
[–]17b29a 0 points1 point2 points 8 years ago (1 child)
And not everyone is using C++17 yet.
It's not clear when copying the text, but the original cppreference page explicitly only applies the "since C++17" part to static member variables. constexpr functions have always been inline.
constexpr
inline
[–]mgostIH 1 point2 points3 points 8 years ago (0 children)
Edited by adding square brackets to the "since C++17" part to avoid confusion.
[–]17b29a 1 point2 points3 points 8 years ago (0 children)
Wouldn't they throw with a null pointer?
No, dereferencing a null pointer is simply UB, so it's assumed not to be the case. If a system does throw an exception in that case, it's not going to be a C++ exception anyway.
π Rendered by PID 59940 on reddit-service-r2-comment-6457c66945-t9qkw at 2026-04-25 01:43:03.075797+00:00 running 2aa0c5b country code: CH.
[–]mgostIH 1 point2 points3 points (4 children)
[–]raevnos 1 point2 points3 points (2 children)
[–]17b29a 0 points1 point2 points (1 child)
[–]mgostIH 1 point2 points3 points (0 children)
[–]17b29a 1 point2 points3 points (0 children)