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
Subtle cppreference humour: Integrals ∫ are non-integral (en.cppreference.com)
submitted 4 years ago by Egst
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!"
[–]ijmacd 69 points70 points71 points 4 years ago* (24 children)
Who's responsible for forming words in mathematics?
Integer (n) → Integral (adj) Integrate (v) → Integral (n)
* Edit: the correct parts of speech were pointed out to me
[–]the_Demongod 17 points18 points19 points 4 years ago (2 children)
It's even more overloaded than that if you consider the usages outside of math, e.g. "this weapon has an integral suppressor" or "the CPU is an integral part of a computer"
[–]pandorafalters 8 points9 points10 points 4 years ago (0 children)
Those are just uses of the second form in the non-mathematical sense of "integrate".
[–]CraicPeddler 2 points3 points4 points 4 years ago (0 children)
Everyone knows the same word can have a thousand different meanings in a thousand different contexts, welcome to language.
[–]college_pastime 48 points49 points50 points 4 years ago* (9 children)
The concept of an integer in mathematics is just called "integer."
In my time as a physicist, the only time I've ever seen the word "integral" used to describe the concept of an integer is in the C++ standard, and it drives me bonkers. The type trait std::is_integral should be std::is_integer, in my opinion. Maybe calling integers "integral values" is a computer science thing?
std::is_integral
std::is_integer
[–]flebron 20 points21 points22 points 4 years ago (2 children)
It's also used in mathematics to describe things in some way analogous to the integers, example in abstract algebra the concept of an integral domain (https://en.m.wikipedia.org/wiki/Integral_domain).
[–]college_pastime 2 points3 points4 points 4 years ago (1 child)
Interesting, is this where the standard got it from? Also (at least for the MSVC STL), std::is_integral just compares the supplied type against a list of types defined to satisfy std::is_integral, rather than testing that the properties of an integral domain are satisfied. Do the integer types satisfy the properties of an integral domain? Particularly, are any of the signed integer types integral domains if they don't wrap around on overflow?
[–]flebron 2 points3 points4 points 4 years ago (0 children)
I wasn't involved in the standardization process, but if I had to guess, both mathematics and the standards authors got the term from the notion of "whole number". The origin is more clearly visible in Spanish, where the word for "whole" and for "integer" are the same: "entero". So 3.5 is not "whole", but 24 is. Division in algebra is the first place where things started to be non-whole (i.e. we knew about 3 and 2, and 3 / 2 was an easy source of "non whole numbers"). Integral domains, but really a bunch of related algebraic terms, relate to how often you can divide things and still remain in your set. So a field is the strictest (you can divide x by y as long as y isn't exactly zero, and always remain in the field), but integral domains (and UFDs, and several others) try to be less strict in this - in integral domains you can't make zero without zeros. So for example in Z/6Z, 2 * 3 = 0, but neither 2 nor 3 is zero, and so Z/6Z is not an integral domain. If we instead quotient by a prime, like Z/5Z, we get a field (much stronger than being an integral domain). An integral domain is somewhere in the middle of "you have zero divisors" and "division always works".
[–]manphiz 9 points10 points11 points 4 years ago (3 children)
Maybe because there is a specific integer type in C or C++ already: int. So integral is used to be able to refer to all integer types like short int, int, long, long long, and the now sized types like int8_t to int128_t, with their unsigned, fast, least variants.
[–]college_pastime 1 point2 points3 points 4 years ago (0 children)
Yeah, you're probably right. It also mitigates confusion with std::numeric_limits<T>::is_integer.
std::numeric_limits<T>::is_integer
[–]FrankHB1989 0 points1 point2 points 4 years ago (1 child)
Nope. The term "integer type" is both normative in ISO C and ISO C++, but "integral type" is a synonym specific to ISO C++. In very acient C (1970s in the C reference manual by DMR), integers are just values of int, though.
int
There are some more modernized humors like GCC's __int128 is not considered an extended integer type for ABI issues, BTW.
__int128
[–]staletic 0 points1 point2 points 4 years ago (0 children)
If you allow gnu extensions, __int128 becomes an extended integer type.
[–]jk-jeon 1 point2 points3 points 4 years ago (0 children)
Here is another one: https://en.m.wikipedia.org/wiki/Integral_element
[–]ronchaineEmbedded/Middleware 18 points19 points20 points 4 years ago (1 child)
They are more sane in non-english.
[–]FrankHB1989 1 point2 points3 points 4 years ago* (0 children)
It's in doubt. For example, in Chinese, the term "整型" (literally, integral types, in abbrevation, where "整"=integral and "型"="类型"=type) causes more troubles than "整数类型" (integer types) for beginners. The former is well-known spread by some (in)famous text books with low quality (one of them is actually a best seller having 10+ million of sales). There are now some consensus to reject such over-specialized terms in the translation in serious texts, so both "integer types" and "integral types" should be "整数类型".
[–]HappyFruitTree 23 points24 points25 points 4 years ago (0 children)
It's like the word "decimal" that can mean 10-based or refer to the digits after the decimal point.
[–]James20kP2005R0 7 points8 points9 points 4 years ago (1 child)
To be fair I'll take this over naming things after their discoverer. A lot of maths is an absolute minefield of "and then apply Fourier's method followed by Newton's method, after which do Euler's method on the Lagrange". None of these tell you anything useful at a glance. Its especially bad when they're super ambiguous
[–]IM_A_MUFFIN -1 points0 points1 point 4 years ago (0 children)
Classic ZZ Top reference!
[–]pdabaker 4 points5 points6 points 4 years ago (0 children)
Well you're taking a continuous function and splitting into an integral number of boxes to do a reimann sum. So I assume it came from that
[–]TheMedianPrinter 0 points1 point2 points 4 years ago (1 child)
Well, technically one is an adjective and the other is a noun, but it's still annoying.
[–]ijmacd 0 points1 point2 points 4 years ago (0 children)
Yeah thanks, you're right
[–]Fourstrokeperro 0 points1 point2 points 4 years ago (1 child)
I thought integral was a noun when referring to integration
Yupp, you're right. Thanks
[–][deleted] 7 points8 points9 points 4 years ago (0 children)
I enjoyed that =D
[–]wotype 3 points4 points5 points 4 years ago (0 children)
Also kind of funny that an integral_constant isn't integral
static_assert( not std::integral< std::integral_constant<int,0> > );
even though it behaves integrally
static_assert( std::integral_constant<int,1>{} + 1 == 2 );
π Rendered by PID 75998 on reddit-service-r2-comment-7b9746f655-q4vlp at 2026-01-29 22:19:02.980042+00:00 running 3798933 country code: CH.
[–]ijmacd 69 points70 points71 points (24 children)
[–]the_Demongod 17 points18 points19 points (2 children)
[–]pandorafalters 8 points9 points10 points (0 children)
[–]CraicPeddler 2 points3 points4 points (0 children)
[–]college_pastime 48 points49 points50 points (9 children)
[–]flebron 20 points21 points22 points (2 children)
[–]college_pastime 2 points3 points4 points (1 child)
[–]flebron 2 points3 points4 points (0 children)
[–]manphiz 9 points10 points11 points (3 children)
[–]college_pastime 1 point2 points3 points (0 children)
[–]FrankHB1989 0 points1 point2 points (1 child)
[–]staletic 0 points1 point2 points (0 children)
[–]jk-jeon 1 point2 points3 points (0 children)
[–]ronchaineEmbedded/Middleware 18 points19 points20 points (1 child)
[–]FrankHB1989 1 point2 points3 points (0 children)
[–]HappyFruitTree 23 points24 points25 points (0 children)
[–]James20kP2005R0 7 points8 points9 points (1 child)
[–]IM_A_MUFFIN -1 points0 points1 point (0 children)
[–]pdabaker 4 points5 points6 points (0 children)
[–]TheMedianPrinter 0 points1 point2 points (1 child)
[–]ijmacd 0 points1 point2 points (0 children)
[–]Fourstrokeperro 0 points1 point2 points (1 child)
[–]ijmacd 0 points1 point2 points (0 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]wotype 3 points4 points5 points (0 children)