This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [using gcc book] 5.25 declaring attributes of functions


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]