Re: incorrect use of 'pure' attribute

Sam James <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs
Organization Gentoo
Message-ID <[email protected]>
Paul Eggert <[email protected]> writes:

> 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.

Yes, you're right. My apologies! I'd missed it's static apparently.

>
> 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.

sam
signature.asc (application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmp3UwMbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkPPz
AQCsReFLng7wkJVo7E/d+teM88XSJ1BDdVMWbe9Hm+Tl3gD/W1CUg8+F0qoIfDoe
0xTYLcT8ZB9DIMbMcxG5LTW+xwg=
=6SfS
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.