A list for the developers of CellML tools

Text archives Help


[cellml-dev] r2062 - pce/trunk/DataCollector


Chronological Thread 
  • From: ak.miller at auckland.ac.nz (Andrew Miller)
  • Subject: [cellml-dev] r2062 - pce/trunk/DataCollector
  • Date: Thu, 17 Jan 2008 15:33:17 +1300

Randall Britten wrote:
> I looked at revision 2065, and I agree, that is far closer to the style I
> think we should follow. Can we get rid of the CHECK_DUP macro? Personally I
> don't like macros.
>
I'm not sure what we should replace it with in this case. It is usually
better to macro out code to show the meaning rather than to let the
meaning of the code be hidden in the details of the implementation due
to excessive repetitiveness.

In this particular case, we could just get rid of the checks all
together - I am not sure what the cost of calling lineTo twice for the
same point is, but I suspect that creating lots of zero-length line
segments might be bad. I don't think that creating some sort of extra
abstraction and trying to use templates or anything like that would help
readability here either.

We could make it a 'boolean valued macro' and make the code more like:
if (EXTREME_POINTS_ARE_SAME(0, 1))
mRenderContext->LineTo(mxMultiplier * ExtremePoints[tb[1]].X + mxOffset,
myMultiplier * ExtremePoints[tb[1]].Y + myOffset);

Writing the code as a loop could be another option.

However, I don't really think the readability of that macro is so bad as
to justify so much effort on it.

Best regards,
Andrew





Archive powered by MHonArc 2.6.18.

Top of page