Re: incorrect use of 'pure' attribute
Paul Eggert <[email protected]>
| Newsgroups | gmane.comp.lib.gnulib.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 8/8/26 05:38, Sam James wrote: > The comment simply isn't right and it makes an assertion that doesn't > reflect reality. It is not validly const if it uses global memory to > affect what it returns, even if later calls are OK. But __eloop_threshold doesn't use global memory to affect what it returns. It always returns the same value, every time. So, even though __eloop_threshold uses static storage (I assume that's what you mean by "global memory"), its use of that static storage doesn't affect what it returns. In this sense I guess __eloop_threshold differs from a common C++ idiom, in which even though the function always returns the same value, that value is affected by what's already in memory. __eloop_threshold does not have that property. If my understanding is incorrect I'd appreciate a clarification, e.g., an example of an optimization that GCC might apply that would be invalid for __eloop_threshold.