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]

Re: /internet



  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


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