Merry Christmas, Darin!
Thank you for your comments:-
> First of all, a minor "optimization" - you are
> returning "false" (0) when the logical expression is
> true, and "true" (non-0) when the logical expression
> is false. Sounds confusing? It is to me. You'd be
> best keeping the original order.
Pontification is for priests, Darin. :-)
Best would be to look at the code generated. When the choice is binary,
either has equal effect. Execution time then becomes the decider. Testing for
zero/ nonzero is generally quicker than testing for 1/0. Also "true" and
"false" if used at all are merely identifiers, and are undefined in C - case
is significant, so as you say it does come down to a matter of taste.
> Secondly, a minor readability item for both of you.
> Most people read number lines just perfectly - take
> advantage of that in your code:
I have read the rest of your message, Darin. I take your point about
readability, and the macro you finally get to is neat and would work, but
it's far more general than the context needed, so I'll stick to my guns, as I
said to Auke yesterday (q.v.) Simplicity, if not everything, is close kin to
clarity. :-)
Finally, I hope this thread has not put anybody off using macros. :-)
Best wishes,
Bill.
---
---------------
* Origin: bill@escan.demon.co.uk (2:2504/200)
|