Hacker News new | ask | show | jobs
by markrages 3461 days ago
You are dividing one constant by another -- surely that would be handled at compile time?
2 comments

You are correct, the compiled code will be the same whether you use a macro or not. In fact, this is true for any C macro. A macro is merely a source code text substitution done by the preprocessor. Using a macro is exactly the same as writing out the equivalent macro expansion everywhere you use it.

My suggestion to use a macro is not because of any difference in the compiled code, but to improve the readability of the source code.

While it may be optimized, I think the suggestion is that instead of using a hack repeatedly, it is arguably better to be DRY and abstract it away.