Re: help with statistics library
- From: Lionel B <me@xxxxxxxxxxx>
- Date: Thu, 26 Apr 2007 09:01:18 +0000 (UTC)
On Thu, 26 Apr 2007 00:34:23 +0000, Jens Thoms Toerring wrote:
Richard Weeks <rweeks@xxxxxxxxxx> wrote:
http://members.shaw.ca/bystander/statsource.html
My first impression after a short look is that it looks rather
well-written and I so simply start with nit-picking:
[...]
4) There are a few instances where you cast where it isn't necessary.
E.g. if you divide a double by an int you don't have to cast the int
to double, the compiler will do that for you. The same holds for
instances where you assign an int to a double. Of course, the cast
doesn't hurt, but as a rule I avoid casts unless they are really
necessary and thus see casts as a "red flag" that says "here's
something happening that may need re-examination".
Just a nitpick of your nitpick: I tend to take the opposite view that
explicit casts are preferable to implicit casts, since they make the
intention of the code clearer (at the expense of some verbosity); if I
see:
double x,y;
int n;
/* lots of code */
y = x/n;
then I have to remind myself (with reference to the declaration of n)
that casting is taking place. On the other hand:
y = x/(double)n;
makes it immediately clear that a cast is intended.
No big deal though, it's probably a personal preference.
--
Lionel B
.
- Follow-Ups:
- Re: help with statistics library
- From: Richard Heathfield
- Re: help with statistics library
- References:
- help with statistics library
- From: Richard Weeks
- Re: help with statistics library
- From: Ico
- Re: help with statistics library
- From: Richard Weeks
- Re: help with statistics library
- From: Willem
- Re: help with statistics library
- From: Richard Weeks
- Re: help with statistics library
- From: Jens Thoms Toerring
- help with statistics library
- Prev by Date: How to judge if the graph is cyclic when add a new edge?
- Next by Date: Re: [C++] Command line parser
- Previous by thread: Re: help with statistics library
- Next by thread: Re: help with statistics library
- Index(es):
Relevant Pages
|