From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Robert P. J. Day" Subject: Re: const int f() and int f() const Date: Sun, 19 Mar 2006 12:30:36 -0500 (EST) Message-ID: References: <200603192048.08780.samjnaa@gmail.com> <000f01c64b76$03558c00$fe01a8c0@g> Mime-Version: 1.0 Return-path: In-Reply-To: <000f01c64b76$03558c00$fe01a8c0@g> Sender: linux-c-programming-owner@vger.kernel.org List-Id: Content-Type: TEXT/PLAIN; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ab Cc: Shriramana Sharma , Linux C Programming List 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