Firstly, #define is incorrect due to the semi-colony at the end, and the compiler will break into:
float f = CRANDOM() * 2;
Secondly, I personally try to avoid using a preprocessor by not separating platform-independent sections in cross-platform code, and, of course, code reserved exclusively for DEBUG or non-DEBUG assemblies.
nightcracker correctly states that it will always be “efficiently” built-in, but if you can rewrite the function as inline , I don’t see the benefits of using the preprocessor version, unless the C compiler is built-in.
source share