Tech Off Post

Single Post Permalink

View Thread: template countof confusion-question
  • Mr Crash

    spivonious said:
    Mr Crash said:
    *snip*

    They all do the same thing but with minor syntax differences (+0, pointer vs. reference). I'm not sure what you're looking for here. I'd expect their performance to be identical.

    > I'm not sure what you're looking for here.

     

    Are anyone better over the others ? More c++ "correct"

     

    > They all do the same thing but with minor syntax difference

     

    yes but that minor syntax difference might make one of them better, more useful perhaps but since i'm not a c++ expert i ask in this forum thinking that there should be at least one in here that can answer this question.

     

    #define _countof(_Array) (sizeof(*__countof_helper(_Array)) + 0) 

    Why use the "+ 0", any special reason for it ?
    Is it a compiler hint of some sort ?