Hacker News new | past | comments | ask | show | jobs | submit login

Boost has a macro that's usable in plain C as well, since it uses only the preprocessor.

  #include <boost/utility/binary.hpp>
  char c = BOOST_BINARY(01011010);



Yeah but that is a but similar as BOOST_FOREACH before c++11 -- it just isn't making things any prettier. I think most people nowadays are conditioned to parse the enum-as-bitmasks 0x01, 0x02, 0x04, 0x08 etc, so i would be reluctant to use boost's version in that case. The new operator, however, seems pretty sweet for that use case!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: