Re: pure functions




"Keith Thompson" <kst-u@xxxxxxx> wrote
>
> Discussion of pure functions within the context of standard C, and the
> opportunities they can provide for potential optimizations, is
> topical. Discussion of implementation-specific features to support
> pure functions are off-topic (<OT>I'll take the liberty of mentioning
> gcc's __attribute__ ((pure)), but I won't go into detail</OT>).
> Advocacy of such features for future standards is probably more
> topical in comp.std.c, but I see no real problem with bringing it up
> here.
>
Discussion about how to use C effectively, so that we can enjoy the benefits
of pure functions despite the fact that the language provides no way to
enforce lack of side-effects, is also topical.
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.


.