Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    T

    Thomas Becker

    thbecker.net · Personal blog · on HN since 2012

    Thomas Becker writes C++ and JavaScript tutorials, best known for his article explaining C++ rvalue references.

    Visit blogHN submissions
    Languages & CompilersProgramming
    What HN says

    HN links it as the standard explanation of rvalue references, move semantics and perfect forwarding; the author notes it ranks first in Google for the topic.

    Stats for nerds
    15HN people shared it
    9linked in comments
    32story points
    Jul 2023last shared
    2013people per year2023

    Top posts on HN

    1. 1
      C++ Rvalue References Explained
      11 people · 13 points · first shared 2012 · Discussion on HN
    2. 2
      OOP in JavaScript: A Tutorial for Those Who Are Accustomed to Classes
      1 person · 13 points · first shared 2014 · 3 comments on HN
    3. 3
      I didn't know that C++ auto and decltype were this tricky
      1 person · 3 points · first shared 2013 · Discussion on HN
    4. 4
      Electronic Book Readers vs. Paper and Ink
      1 person · 3 points · first shared 2015 · Discussion on HN
    5. 5
      Section 08
      2 people · first shared 2015
    6. 6
      Page 01
      1 person · first shared 2015
    7. 7
      Section 07
      1 person · first shared 2015
    8. 8
      Section 03
      1 person · first shared 2013

    What HN people wrote when they linked it

    • rsp1984Feb 2020

      C++ “move” semantics are simple, but they are still widely misunderstood.

      No, they aren't simple and the fact that are still widely misunderstood is basically proof of that.

      Maybe, just maybe, it has something to do with stuffing rvalue references, perfect forwarding and the whole universal-references-template-clusterfuck into one and the same syntax. [1]

      The default compiler-generated move can leave behind a null sp member

      Which is precisely why std::move should be used with caution, which, in turn, is precisely why many codebases are still avoiding it. This problem in particular could have been avoided by not auto-generating move constructors.

      I really want to like this feature of C++, but I feel its design is just so horribly bad and confusing that I'd feel like a total d..k if I started to force it on a team of developers (of various levels of experience) if there's no crystal clear need for it (and let's be honest, C++ was already pretty successful in getting shit done before there was std::move and rvalue references).

      [1] http://thbecker.net/articles/rvalue_references/section_01.html

    • pmelendezMay 2015

      The link that you provided does not have to do with malloc and/or free but with perfect forwarding:

      http://thbecker.net/articles/rvalue_references/section_07.html

      Also that example uses a Factory pattern which is actually verbosing the example, but it's like comparing apple and oranges since that's OOP which you actually wouldn't be doing in C.

      What you would be comparing is something like:

      mystruct * stcVar = malloc(sizeof(mystruct));
      free (stcVar);

      Vs.

      std:shared_ptr<mystruct> stcVar;

      Of course that is a stupid example; However things gets more interesting when you have pieces of code sharing the same structure (threads maybe?) and you don't know exactly which code should be the one in charge of releasing the pointer.

    • stinosAug 2014

      I've looked at rvalue reference, and it seems to return an assignable pointer to do other thing from a function

      I'm not sure how you came to that conclusion, but it is not correct. R-values don't have much to do with pointers at all. Though they sometimes do solve problems you would be tempted to use pointers for. I admit I do find it hard to explain briefly what they are though. Maybe these are helpful, though it might be hard to grasp if you don't already properly understand C++:
      http://www.artima.com/cppsource/rvalue.html
      http://thbecker.net/articles/rvalue_references/section_01.html. This example basically gives an idea of why they are useful: http://thisthread.blogspot.be/2011/03/what-is-rvalue-reference-good-for.html

    • shmerlAug 2014

      C++11 has some tricky changes which are way not obvious at the first glance. A few useful resources I found:

      * http://thbecker.net/articles/rvalue_references/section_01.html

      * https://en.wikipedia.org/wiki/Copy_elision

      * http://en.cppreference.com/w/cpp/language/eval_order

      * https://akrzemi1.wordpress.com

      * https://dl.dropboxusercontent.com/u/13100941/C%2B%2B11.pdf

      Understanding the combination of copy elision and move semantics (when and how they are applied) can require one to read the standard.

      C++11 is not simpler than older C++, but using it is easier, if you have a good understanding of it.

    • tuhdoAug 2014

      Well currently I only work with C not C++ anymore so my knowledge might be outdated. I thought that the rvalue reference is something new in C++11, as I read it here: http://thbecker.net/articles/rvalue_references/section_01.html. Your article seems to mention different thing from 2008? In the article I read, a function returns a pointer that you can assign it like this: get_pointer() = 1;

    • ArechJul 2023

      I think you're talking about perfect forwarding and reference collapsing rules [1, 2], introduced in C++11, but that is a bit different thing occurring only in a template instantiation context. Normally, you wouldn't see triple ampersands in sane C++ code, afaik.

      [1] http://thbecker.net/articles/rvalue_references/section_08.html

      [2] https://en.cppreference.com/w/cpp/language/reference

    Related

    Andrzej's C++ blogakrzemi1.wordpress.com35 people

    A bug in GCC that may cause memory leaks in valid C++ programs

    Andrzej's C++ blog
    Personal · last shared 2025
    Oleg Kiselyovokmij.org251 people

    How the OCaml type checker works (2022)

    Oleg Kiselyov
    Personal · last shared 2026
    Scott Meyersscottmeyers.blogspot.com43 people

    } // good to go

    Scott Meyers
    Personal · last shared 2025
    C++ Storiescppstories.com35 people

    Embracing Modern C++ Safely, Book Review

    C++ Stories
    Personal · last shared 2026
    LLVM Blogblog.llvm.org226 people

    Clang Is Now Used to Build Chrome for Windows

    LLVM Blog
    Company · last shared 2026
    Bartek's Coding Blogbfilipek.com49 people

    Coding without Google

    Bartek's Coding Blog
    Personal · last shared 2021
    PVS-Studio Blogviva64.com135 people

    Criticizing the Rust Language, and Why C/C++ Will Never Die

    PVS-Studio Blog
    Company · last shared 2021
    Modernes C++modernescpp.com35 people

    C++ 20: The Core Language

    Modernes C++
    Personal · last shared 2026