HNHacker News
TopNewBestAskShowJobs

beatbrokedown

123 karma · joined July 17, 2012

submissionscomments
beatbrokedown··on Why undefined behavior may call a never-called function
If you make one small change to this file you can cause clang and gcc to both prevent this from compiling if you are using warnings.

  namespace {
    void NeverCalled() { Do = EraseAll; }
  }
or marking NeverCalled as static itself.

Results in warning: unused function NeverCalled.

In general this is best practice for functions defined and used in a single translation unit.

beatbrokedown··on GCC 6.2 Released
Fixes https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED...
beatbrokedown··on A Quick Puzzle to Test Your Problem Solving
My fuzzing went:

8 4 2 (no) 1 2 3 (yes) 1 1 1 (no) 1 100 123 (yes) 1.0 1.1 1.2 (yes)

answer: incrementing numbers

beatbrokedown··on GCC 4.9 Release Series – Changes, New Features, and Fixes
Interesting the main page http://gcc.gnu.org/ lists 4.9 as the current release as opposed to Development release.
beatbrokedown··on Rich Hickey on Functors in C++ (1994)
Just in case anyone forgets this is from 1994(it's in the title!). Typical modern C++ has been using this pattern for quite a while (boost::function / boost::bind) and it is now even part of the standard (std::function / std::bind). So don't go implementing Functor0->Functor9 yourself!

It is always nice though to see how C++ has grown after so many years and clearly still has staying power for even new projects.