Could a function change its argument(s)!?

Tapani Tarvainen tarvaine at tukki.jyu.fi
Thu Aug 24 05:29:37 AEST 1989


Assume an architecture where 
(1) address registers are special so that putting or even having
    an invalid pointer there will cause a trap; and
(2) there are enough of them to spare.

Question:  Could they be used for register variables?
How could free() be implemented?

More specifically, would it be legal to implement free() so
that it checks all such registers and trashes them (substituting
some harmless value) if they contain a pointer which becomes
invalid (points into the freed area)?

After all, it's illegal to do anything which them afterwards
anyway.

A case where a function could change not only its arguments
but also other variables never mentioned in the call!?
-- 
Tapani Tarvainen    (tarvaine at tukki.jyu.fi, tarvainen at finjyu.bitnet)



More information about the Comp.std.c mailing list