🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #488

Could a function change its argument(s)!?

#488
From: Tapani Tarvainen
Date: Wed, 23 Aug 1989 19:29
20 lines
1500 bytes
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@tukki.jyu.fi, tarvainen@finjyu.bitnet)
Technical Details
Message-ID: <1190@tukki.jyu.fi>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!brutus.cs.uiuc.edu!wuarchive!wugate!uunet!mcsun!sunic!tut!tukki!tarvaine
References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU> <CLIFFS.89Aug14102516@suntrek.east.sun.com> <320@cubmol.BIO.COLUMBIA.EDU> <3777@buengc.BU.EDU> <1989Aug17.005548.745@twwells.com> <568@augean.OZ> <14343@haddock.ima.isc.com> <572@augean.OZ> <10804@smoke.B

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!brutus.cs.uiuc.edu!wuarchive!wugate!uunet!mcsun!sunic!tut!tukki!tarvaine
From: tarvaine@tukki.jyu.fi (Tapani Tarvainen)
Newsgroups: comp.std.c
Subject: Could a function change its argument(s)!?
Summary: picking nits
Message-ID: <1190@tukki.jyu.fi>
Date: 23 Aug 89 19:29:37 GMT
References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU> <CLIFFS.89Aug14102516@suntrek.east.sun.com> <320@cubmol.BIO.COLUMBIA.EDU> <3777@buengc.BU.EDU> <1989Aug17.005548.745@twwells.com> <568@augean.OZ> <14343@haddock.ima.isc.com> <572@augean.OZ> <10804@smoke.B
Reply-To: tarvaine@tukki.jyu.fi (Tapani Tarvainen)
Organization: University of Jyvaskyla, Finland
Lines: 20