From: John Lamb <J.D.Lamb@btinternet.com>
To: gsl-discuss@sources.redhat.com
Subject: Re: Question
Date: Tue, 01 Feb 2005 21:28:00 -0000 [thread overview]
Message-ID: <41FFF48E.4040903@btinternet.com> (raw)
In-Reply-To: <OF6F44480B.8C7B6053-ON80256F9B.00657802-00256F9B.0065ACB9@db.com>
Przemyslaw Sliwa wrote:
> All,
>
> I was just wondering what means
>
> double gsl_cdf_ugaussian_Pinv (const double P)
>
> Correct me if I am wrong but it seems the const word is not required
> in this case and we cannot change the value of P.
>
I think you are right, const is not required and you don't need to worry
about it when calling the function. This is certainly true in C++.
Nonetheless, it is often a good idea to declare an automatic function
parameter const in the function definition. This forces the compiler to
check that you don't change the parameter value in the body of the
function. Similarly, it is a good idea to declare any variable const if
you don't intend to change it.
You can declare the function as
double gsl_cdf_ugaussian_Pinv (double);
and define it as
double gsl_cdf_ugaussian_Pinv (const double P){
...
}
but it may be better to make the two match precisely either because you
may want to use some editing tools that rely on a match or because you
want the code to work on a compiler that can't work oout that the
declaration and definition do match.
--
JDL
next prev parent reply other threads:[~2005-02-01 21:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-01 18:30 Question Przemyslaw Sliwa
2005-02-01 21:28 ` John Lamb [this message]
2005-02-01 22:04 ` Question Gerard Jungman
2005-02-02 18:00 ` Question Brian Gough
2005-02-01 22:12 ` Question Jordi Burguet Castell
-- strict thread matches above, loose matches on Subject: below --
2002-08-23 13:09 question Klauko Mota
2002-09-01 14:32 ` question Brian Gough
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41FFF48E.4040903@btinternet.com \
--to=j.d.lamb@btinternet.com \
--cc=gsl-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).