Anders Knatten
blog.knatten.org · Personal blog · on HN since 2012
Anders Knatten, a C++ developer, writes about the language's value categories, type system and quirks.
What HN saysHN commenters recommend his explanation of lvalues, rvalues, glvalues, prvalues and xvalues as clear and helpful for understanding move semantics.
15HN people shared it
2linked it in comments
23stories submitted
412story points
12 months agolast shared
2012people per year2026
Most-shared posts
- 1Lvalues, rvalues, glvalues, prvalues, xvalues, help (2018)5 people · 249 points · first shared 2018 · 92 comments on HN
- 2The type of char + char4 people · 62 points · first shared 2019 · 45 comments on HN
- 3A Taxonomy of C++ Types2 people · 4 points · first shared 2025 · discussion on HN
- 4Very Strong C++ Track at the NDC Conference2 people · 2 points · first shared 2014 · discussion on HN
- 5A prvalue is not a temporary1 people · 79 points · first shared 2025 · 63 comments on HN
- 6Another Reason to Avoid #includes in Headers1 people · 2 points · first shared 2012 · 1 comments on HN
- 7We probably shouldn’t have constexpr conditional operator1 people · 2 points · first shared 2023 · discussion on HN
- 8C++ on a Friday: +“”1 people · 2 points · first shared 2018 · discussion on HN
- 9No-one knows the type of char + char1 people · 2 points · first shared 2019 · discussion on HN
- 10Microsoft C++ Versions Explained1 people · 2 points · first shared 2022 · discussion on HN
- 11I Wrote a C++ Book1 people · 2 points · first shared 2024 · discussion on HN
- 12References don’t have top-level CV-qualifiers1 people · 1 points · first shared 2023 · discussion on HN
- 13The difference between no move constructor and a deleted move constructor1 people · 1 points · first shared 2021 · discussion on HN
- 14Help save CppQuiz.org: We’re porting to C++171 people · 1 points · first shared 2018 · discussion on HN
- 15How to avoid includes in headers1 people · 1 points · first shared 2012 · discussion on HN
What HN people wrote when they linked it
spacechild1 · 2025-11-06
This is actually a very nice explanation!
I also enjoyed the linked article about the 5 value types: https://blog.knatten.org/2018/03/09/lvalues-rvalues-glvalues-prvalues-… For some reason I never bothered to look up these terms as they sounded so obscure. Turns out the taxonomy is pretty clear and it's just a refinement of the existing two value types (lvalues and rvalues).
EDIT: I do think the naming is rather confusing and inconsistent, though.
cjensen · 2025-11-06
He has a good article on that at [1]
But here's the gist: sometimes you have an object you want to copy, but then abandon the original. Maybe it's to return an object from a function. Maybe it's to insert the object into a larger structure. In these cases, copying can be expensive and it would be nice if you could just "raid" the original object to steal bits of it and construct the "copy" out of the raided bits. C++11 enabled this with rvalue references, std::move, and rvalue reference constructors.
This added a lot of "what the hell is this" to C++ code and a lot of new mental-model stuff to track for programmers. I understand why it was all added, but I have deep misgivings about the added complexity.
[1] https://blog.knatten.org/2018/03/09/lvalues-rvalues-glvalues-prvalues-…