This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make attribute functions pure
- From: Robert Dewar <dewar at gnat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: paul at codesourcery dot com, gcc at gcc dot gnu dot org
- Date: Fri, 23 Jul 2004 14:10:43 +0100
- Subject: Re: [PATCH] Make attribute functions pure
- References: <10407231242.AA27180@vlsi1.ultra.nyu.edu>
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).