Could a function change its argument(s)!?

Rick Schubert rns at se-sd.NCR.COM
Sat Aug 26 08:30:05 AEST 1989


In article <1190 at tukki.jyu.fi> tarvaine at tukki.jyu.fi (Tapani Tarvainen) writes:
>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)?

There is a principle that states that the implementation may do anything if
a conforming program cannot tell the difference (I think this is part of
the "as if" rule).  This would seem to apply here.  Since there doesn't
appear to be any way that a conforming program could use the contents of
such registers (until they are reassigned legitimate values), it doesn't
seem like it would make any difference if they were trashed.

-- Rick Schubert (rns at se-sd.sandiego.NCR.COM)



More information about the Comp.std.c mailing list