Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2002:
[Freeciv-Dev] Re: (PR#2261) [Patch] Remove const
Home

[Freeciv-Dev] Re: (PR#2261) [Patch] Remove const

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#2261) [Patch] Remove const
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 29 Oct 2002 14:03:28 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, Oct 29, 2002 at 01:43:46PM -0800, Anthony J. Stuckey via RT wrote:
> On Mon, Oct 28, 2002 at 11:56:07AM -0800, Raimar Falke via RT wrote:
> > The attached patch removes superfluous consts in the type of the
> > return value of various functions.
> 
>       I'm probably showing my ignorance of C esoterica here, but why are
> these superfluous?
> 
>       Is the fact that they are functions (which can theoretically return
> anything) destructive of the "const"-ness of their return?  One could
> imagine a string pointer initialized and never changed through the rest of
> execution.  (Is that not strong enough to deserve "const"?)

There are two kinds of consts (see
http://www.eskimo.com/~scs/C-faq/q11.9.html). The intel compiler has
the idea that a constant pointer doesn't make sense as a return
type. This is plausible because the "virtual" return variable is only
set once in the callee (at the time of the return).

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Last year, out in California, at a PC users group, there was a demo of
  smart speech recognition software. Before the demonstrator could begin
  his demo, a voice called out from the audience: "Format c, return. Yes,
  return." Damned short demo, it was.



[Prev in Thread] Current Thread [Next in Thread]