const functions

From: Robert Collins <robert.collins@dont-contact.us>
Date: Tue, 23 Oct 2001 13:54:25 +1000

I've been reading the gcc manual (shock, horror) and I ran across this
function attribute:

const
Many functions do not examine any values except their arguments, and
have no effects except the return value. Such a function can be subject
to common subexpression elimination and loop optimization just as an
arithmetic operator would be. These functions should be declared with
the attribute const. For example,
        int square (int) __attribute__ ((const));

I've written a number of functions that meet these criteria in the auth
code - is there any reason we can't use this? (Assuming it's protected
so as not to confuse other compilers).

Rob
Received on Mon Oct 22 2001 - 21:51:05 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:34 MST