When categorising a functions purity i also would like to identify the
cause of the impurity. In particular for a function that is impure i
want to categorise the impurity cause as:
* modifies global state
* modifies a function parameter
* modifies the object state (this is an extension of the function
parameter on the "this" parameter)

Hi,
        Sounds like you want to (at least):

1) automatically qualify every declaration (including parameters, member declarations, and member function declarations) with 'const'.

2) forbid the use of the '=' operator family (including +=, etc...)
(might be redundant with #1)

Does this accurately summarize your proposed analysis? As a crude start, maybe you could alter the syntax trees, and let the rest of compilation catch any resulting violations?

The reason for posting this is to ask. Is there code in GCC that
already does something "similar" in say one of the optimisation passes
so i can get a look at how to get started on this?

Fang

David Fang
Computer Systems Laboratory
Electrical & Computer Engineering
Cornell University
http://www.csl.cornell.edu/~fang/
        -- (2400 baud? Netscape 3.0?? lynx??? No problem!)

Reply via email to