This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: /internet
- To: "Geert Bosch" <bosch at gnat dot com>
- Subject: Re: /internet
- From: Jeffrey A Law <law at hurl dot cygnus dot com>
- Date: Wed, 16 Dec 1998 17:24:01 -0700
- cc: "Joe Buck" <jbuck at synopsys dot com>, "moshier at mediaone dot net" <moshier at mediaone dot net>, "burley at gnu dot org" <burley at gnu dot org>, "egcs at cygnus dot com" <egcs at cygnus dot com>, "hjstein at bfr dot co dot il" <hjstein at bfr dot co dot il>, "tim at wagner dot princeton dot edu" <tim at wagner dot princeton dot edu>, "tprince at cat dot e-mail dot com" <tprince at cat dot e-mail dot com>
- Reply-To: law at cygnus dot com
In message <9812162034.AA17456@nile.gnat.com>you write:
> Another useful difference is that in Ada evaluations of
> functions in "pure" packages are guaranteed to be free of
> side-effects and may reuse results of earlier invocations
> with the same parameters. GCC takes full advantage of this
> by moving them out of loops etc. Of course all elementary
> fpt functions (including complex ones) are defined in pure
> packages and this leads to nice optimizations without sacrifying
> one bit of accuracy.
Right. You just set CONST_CALL_P and all the right things will happen; most
of the optimizers know about pure functions. It was really lame of C not to
have such a concept from day 1.
So to make use of that feature in C we're stuck with attributes. Though maybe
c9x has a reasonable syntax for declaring functions as pure functions.
jeff