[comp.lang.c] 'const' functions

jgm@K.GP.CS.CMU.EDU (John Myers) (12/19/87)

In article <475@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
 >Anyway, why are the Committee only doing half a job?  What's the
 >point of introducing NORMAL (the default being ABNORMAL) without
 >introducing REDUCIBLE (the default being IRREDUCIBLE)?  Having
 >the C compiler recognise that sin(x) or strlen(s) only needs to
 >be evaluated more than once in some complicated expression would
 >be more useful to me than making promises about pointers that
 >the compiler isn't apparently expected to check, and the 'noalias'
 >attribute on the arguments is not enough to allow that optimisation.

A reasonable syntax for such a thing would be to declare such functions
as being 'const'.  The overloading of the keyword would be analogous to
(but not the same as) the overloading of the keyword 'static'.