Re: pure functions



In article <slrndal21b.87j.chris@xxxxxxxxxxxxxxxxxx>,
Chris Croughton <chris@xxxxxxxxxxxx> wrote:
>
>On Fri, 10 Jun 2005 21:30:57 +0000 (UTC), Malcolm
> <regniztar@xxxxxxxxxxxxxx> wrote:
>
>> For instance you could have a convention that pure functions always take
>> single-letter parameters, non-pure functions always take at least one
>> parameter with more than one letter.
>
>Or no parameters at all (a function which has no parameters can't be
>'pure' unless it is trivial and returns a constant).

There are also "short term" pure functions like time() and ftell()
which normally cannot be treated as pure by the compiler, but which
are nonetheless good candidates for manually hoisting out of tight loops
in which nothing in the loop resets the date or writes to the file.
--
7842++
.



Relevant Pages

  • Re: pure functions
    ... >>> For instance you could have a convention that pure functions always take ... However taking timeout of the loop can produce different results. ... On some platforms a file position can be altered by something other than ...
    (comp.lang.c)
  • Re: pure functions
    ... > For instance you could have a convention that pure functions always take ... > single-letter parameters, non-pure functions always take at least one ...
    (comp.lang.c)