Developer Blog

A lot of C programmers will recognise this:

#define max(A, B)  ((A) > (B) ? (A) : (B))

It’s a macro for determining which is bigger, A or B. It will work for lots of different types and was originally come from The C Programming Language by Kernighan and Ritchie.

There is a really interesting discussion on the “max” macro on LWN, Who knew there was a difference between “constant value” and a “constant expression”!

Leave a comment

Your email address will not be published. Required fields are marked *