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

    -Werror-sizeof-pointer-div
Or in C++:

    #include <type_traits>

    template < typename T, std::size_t N >
    constexpr std::size_t count_of(const T (&)[N]) { return N; }

    #define COUNTOF(a) std::integral_constant<std::size_t, count_of(a)>::value
(C++03 friendly versions are entirely possible, but left as an exercise to the reader)



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

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

Search: