[Swan-dev] *cmp is a little harder to read

Andrew Cagney andrew.cagney at gmail.com
Fri Nov 3 00:28:47 UTC 2017


> Would renaming it "delta_less" help?  Does that make it two chunks
> cognitively?  deltatimeless is pretty undigestible.  "before" is a
> really nice name but it doesn't flag what kind of time is being
> considered.  Maybe "sooner" is better considering that deltatimes are
> (I think) normally in the future).  Naming is important and tricky.
>
>
The more I look at this code the more I think deltatime_t should be reduce
to:

   typedef struct { intmax_t ns; } deltatime_t;

and we simply accept that .ms (milliseconds; 1/1000s) is "public" so that:

   deltatime_t f(deltatime_t a, deltatime b) {
      if (a.ms > b.ms) ...
      return deltatime_ms(a.ms + b.ms);
  }

is acceptable.


My suggestion: keep deltaless (however spelled (but not dataless)).
> Rewrite individual calls if and only if it improves readability.  New
> calls should use the most readable.  See where we get after a suitable
> period.
> _______________________________________________
> Swan-dev mailing list
> Swan-dev at lists.libreswan.org
> https://lists.libreswan.org/mailman/listinfo/swan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libreswan.org/pipermail/swan-dev/attachments/20171102/76651ab5/attachment.html>


More information about the Swan-dev mailing list