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

Roberto Bagnara bagnara at cs.unipr.it
Mon Oct 10 08:46:25 CEST 2011


On 10/10/11 06:03, Anthony Foiani wrote:
> On Sun, Oct 9, 2011 at 12:59 PM, Roberto Bagnara <bagnara at cs.unipr.it <mailto: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.

Hi Anthony,

thank you very much for your report.  I believe you are completely
right: I have made the necessary changes in commit
http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=8f37574794416e4c97d012e8a51be42fe3b310aa
Cordially,

    Roberto

-- 
Prof. Roberto Bagnara
Applied Formal Methods Laboratory
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list