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: [PATCH] Make attribute functions pure


Richard Kenner wrote:

Sorry, I obviously must not have been clear. I perfectly well understand that
pure functions can't have side effects of the sort you show.

There is no rule in Ada that prevents pure functions from having side effects. The rule is simply that you don't have to recall them if the arguments are identical, so if you have side effects (e.g. counting the number of times a function is called), then that's fine but this count may not be called for each call in the source (which in fact in that particular case, is clearly what you want).



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