Self-modifying code

Steven Ryan smryan at garth.UUCP
Tue Jul 26 05:52:41 AEST 1988


>If the machine allows a change to one variable (an array, say) to
>affect some other unrelated variable, then it is not conforming to
>the intent of my program.  In fact, it is not conforming to anything
>useful at all, since nobody would argue that it is useful programming
>practice to ever do such a thing on purpose (I hope?).

This particular example is done all the time in handling recursive data
structures.

>>Can it be done?  Well, in one sense the answer is clearly yes, because a
>>proof of program correctness has to include it, and we know that automating
>>such proofs is possible (although seldom practical at the moment).

Depends on whether all possible programs (including those of monkey
programmers) or just `practical' programs are considerred. Formal proofs
of all possible programs are impossible, flat out, no appeal. Formal proofs
of practical programs depend on how powerful practical has to be to remain
useful.



More information about the Comp.lang.c mailing list