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
    H

    Howard Hinnant

    howardhinnant.github.io · Personal blog · on HN since 2014

    Howard Hinnant, a C++ standard library designer, writes about C++ date algorithms, allocators, coding guidelines, and standard library containers.

    Visit blogHN submissions
    Languages & CompilersProgrammingSystems & Performance
    What HN says

    HN commenters cite it for the stack allocator, the container comparison page, and the date library, treating it as an authoritative C++ source.

    Stats for nerds
    17HN people shared it
    14linked in comments
    89story points
    Apr 2024last shared
    2015people per year2024

    Top posts on HN

    1. 1
      C++ Coding Guidelines (2014)
      1 person · 52 points · first shared 2017 · 46 comments on HN
    2. 2
      Low-Level Date Algorithms
      5 people · 13 points · first shared 2018 · 1 comments on HN
    3. 3
      Dining Philosophers Rebooted
      1 person · 11 points · first shared 2014 · Discussion on HN
    4. 4
      How I Declare My class And Why
      3 people · 7 points · first shared 2020 · Discussion on HN
    5. 5
      This paper fully documents a date and time library for use with C++11 and C++14
      1 person · 2 points · first shared 2015 · Discussion on HN
    6. 6
      Combinations and Permutations, C++ Implementation
      1 person · 2 points · first shared 2019 · Discussion on HN
    7. 7
      On vector bool
      1 person · 2 points · first shared 2017 · Discussion on HN
    8. 8
      Stack alloc
      2 people · first shared 2017
    9. 9
      Unique ptr03
      1 person · first shared 2015
    10. 10
      Smf.jpg
      1 person · first shared 2022

    What HN people wrote when they linked it

    • danieljhApr 2015

      I'm bored of all the Rust vs. C++ comparisons, when the C++ code is something you simply don't write with modern and idiomatic C++11 and C++14. Not that you could not write it, but seeing this would not pass me reviewing the code.

      The add_one example, as simple as it is, is a horrible example.

      Why not embrace value semantics and write it like:

      int add_one(int x) { return x + 1; }

      There is simply no need for pointers or references. Write simple code first. To the heap allocation example:

      auto x = std::make_unique<int>(5);

      Even if this is a silly example, just say no to unnecessary heap allocation. Why not:

      int x{5};

      Now to the lifted example:

      void add_one(std::unique_ptr<int> num) {
      * num += 1;
      }

      This mixes operations with lifetime management. The add_one function does not need to care about ownership. And it does not need to take ownership of its argument. Instead on the call site do:

      int add_one(int); // from above

      auto p = make_unique(5);
      auto six = add_one(*p); // <-

      There are valid points in the blog post and I know that most snippets are meant as examples. But as someone writing C++14 you can't win me with those kinds of posts, even though I'm having a fun time playing with Rust in my spare time.

      For more about modern practices see: http://klmr.me/slides/modern-cpp/

      Also see Howard Hinnant's unique_ptr tutorial: http://howardhinnant.github.io/unique_ptr03.html

    • kllrnohjApr 2017

      C++ has way way better ways to handle this. What you do instead is a std::vector with an allocator that has a fixed-size chunk of memory to cover your common, small case and falls back to malloc if the size becomes too large to fit into the internal allocation.

      Then your VLA is stack allocated when small and heap allocated when large and works everywhere, even as a return value or other cases where alloca would fail.

      Example: https://howardhinnant.github.io/stack_alloc.html

    • planteenSep 2018

      I don't think that is what is going on, this is invoking the constructor for the weekday class with the "modern" uniform initilization syntax. This solves the old C++ most vexing parse problem.

      https://en.wikipedia.org/wiki/Most_vexing_parse

      It seems like this is the C++ class in question:
      https://howardhinnant.github.io/date/iso_week.html

    • jinchengJLApr 2024

      Having only worked with gcc and clang, OP’s code looked completely fine to me and I was baffled why many comments think the code is at fault. Judging by this page [1], I agree this is entirely MSVC’s doing.

      [1] http://howardhinnant.github.io/container_summary.html

    • signa11Feb 2023

      here is an example of one from howard-hinnant: http://howardhinnant.github.io/stack_alloc.html

    • masklinnOct 2022

      If we're doing thunderdome, JS doesn't beat C++: https://howardhinnant.github.io/smf.jpg

    Related

    Arne Mertzarne-mertz.de26 people

    Modern C++ Features – std::optional

    Arne Mertz
    Personal · last shared 2024
    Victor Zverovichzverovich.net20 people

    Giving up on Julia

    Victor Zverovich
    Personal · last shared 2023
    IT Hareithare.com80 people

    Operation Costs in CPU Clock Cycles

    IT Hare
    Personal · last shared 2026
    Herb Sutterherbsutter.com204 people

    Bjarne Stroustrup on Dennis Ritchie: They said it couldn't be done, & he did it

    Herb Sutter
    Personal · last shared 2026
    Fluent C++fluentcpp.com66 people

    Technical Debt Is Like a Tetris Game

    Fluent C++
    Personal · last shared 2025
    John Regehrblog.regehr.org401 people

    Teaching C

    John Regehr
    Personal · last shared 2026
    cor3ntincor3ntin.github.io32 people

    The Problem with C (2020)

    cor3ntin
    Personal · last shared 2026
    #AltDevBlogADayaltdevblogaday.com163 people

    John Carmack on the importance of Static Code Analysis

    #AltDevBlogADay
    Publication · last shared 2023