[PPL-devel] [GIT] ppl/ppl(master): Magic constants avoided.

Anthony Foiani anthony.foiani at gmail.com
Mon Oct 10 06:03:16 CEST 2011


Roberto --

On Sun, Oct 9, 2011 at 12:59 PM, Roberto Bagnara <bagnara at cs.unipr.it>wrote:

>
> +  //! Number of microseconds in a second.
> +  static const unsigned long MUSECS_IN_SEC = 1000000UL;
>

There is a long history of using just "u" (or "U") as the ASCII-7
representation for "mu" when used as a prefix for 1e-6.

E.g., tv_sec and tv_usec in the "timeval" struct:
   http://pubs.opengroup.org/onlinepubs/009604599/basedefs/sys/time.h.html

+
> +  //! Number of hundredths of a second in a second.
> +  static const unsigned long HSECS_IN_SEC = 100UL;
>

It would be somewhat more consistent (and SI-similar) to use "CSECS_IN...";
"centi-" is 1e-2, while "hecta-" is 1e+2.

Both entirely trivial, but they caught my eye.

Also, I wonder if "_PER_" would read more clearly than "_IN_"?  I tend
towards the former in my code, but I don't know how much of a taste issue
that is.  As a native [american] english speaker, I sometimes read "x in y"
as "x in terms of y", while "x per y" is less ambiguous.

Best regards,
Anthony Foiani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cs.unipr.it/pipermail/ppl-devel/attachments/20111009/ac6ccf12/attachment.htm>


More information about the PPL-devel mailing list