Which of the following implementations is faster? [closed]

Most likely no difference at all. The compiler will inline the function just as much as it inlines the macro. Since macros are much harder to use in a debugger, use a function.

And as I always say in case of “which performs better”, you should always benchmark the different options, since differences in compilers can make some small difference in some cases (and in other cases make a big difference). Asking on SO or some other internet site will only tell you what other people think, not what actually happens in your real case.

Leave a Comment