This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [using gcc book] 5.25 declaring attributes of functions
- From: Bernardo Innocenti <bernie at develer dot com>
- To: Chris Devers <cdevers at pobox dot com>,GCC list <gcc at gcc dot gnu dot org>
- Date: Sun, 24 Aug 2003 17:00:34 +0200
- Subject: Re: [using gcc book] 5.25 declaring attributes of functions
- Organization: Develer S.r.l.
- References: <Pine.OSX.4.56.0308232236290.8695@macdaddy.local>
On Sunday 24 August 2003 04:42, Chris Devers wrote:
> In the discussion of the 'const' attribute, we have this paragraph:
>
> Many functions do not examine any values except their
> arguments, and have no effects except the return value.
> Basically this is just slightly more strict class than the
> 'pure' attribute above, since function is not allowed to
> read global memory.
>
> That second sentence reads clumsily. I'm thinking of this change:
>
> Many functions do not examine any values except their
> arguments, and have no effects except the return value.
> This case is slightly more strict than the @code{pure}
> attribute above, since the function is not allowed to read
> global memory.
>
> Any objections to this change?
I certainly appreciate this change since I've misunderstood the
original text and incorrectly used attribute((const)) in a
function that looked like this:
uint32_t do_div(uint64_t *base, uint32_t rem);
The term "global" memory got me confused. It might be worth
mentioning that it means all memory except local variables
on the stack.
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/
Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html