From: "Robert P. J. Day" <rpjday@mindspring.com>
To: ab <abulfazl@juniv.edu>
Cc: Shriramana Sharma <samjnaa@gmail.com>,
Linux C Programming List <linux-c-programming@vger.kernel.org>
Subject: Re: const int f() and int f() const
Date: Sun, 19 Mar 2006 12:30:36 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0603191229090.4791@localhost.localdomain> (raw)
In-Reply-To: <000f01c64b76$03558c00$fe01a8c0@g>
On Sun, 19 Mar 2006, ab wrote:
>
> > Suppose there is a function f() which returns an integer and does not
> change
> > any value of the class it belongs to, should I declare it as:
> >
> > const int f();
> >
> > or
> >
> > int f() const;
>
> This one.
>
> > What is the difference? Thank you.
>
> The first one returns a 'const int.'
could you give an example where using that first declaration would
actually make a difference, given C's parameter-passing mechanism?
thanks.
rday
next prev parent reply other threads:[~2006-03-19 17:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-19 15:18 const int f() and int f() const Shriramana Sharma
2006-03-19 16:54 ` ab
2006-03-19 17:30 ` Robert P. J. Day [this message]
2006-03-19 17:45 ` Steve Graegert
2006-03-19 23:59 ` Shriramana Sharma
2006-03-20 13:01 ` Glynn Clements
2006-03-22 22:44 ` Benjamin Sobotta
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=Pine.LNX.4.64.0603191229090.4791@localhost.localdomain \
--to=rpjday@mindspring.com \
--cc=abulfazl@juniv.edu \
--cc=linux-c-programming@vger.kernel.org \
--cc=samjnaa@gmail.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 NNTP newsgroup(s).