Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!philmtl!ray From: ray@philmtl.philips.ca (Raymond Dunn) Newsgroups: comp.lang.c Subject: Re: effect of free() Message-ID: <694@philmtl.philips.ca> Date: 8 Sep 89 21:07:46 GMT References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU> <1989Aug17.005548.745@twwells.com> <16022@vail.ICO.ISC.COM> <248@seti.inria.fr> <246@ssp1.idca.tds.philips.nl> <10971@smoke.BRL.MIL> Reply-To: ray@philmtl.philips.ca (Raymond Dunn) Organization: Philips Electronics Ltd. - St. Laurent P.Q., Canada Lines: 28 In article <10971@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: > >No, Martin tried to explain why if(ptr==0) could fail after the free(). >There aren't many common architectures where this would be a problem, >but it can happen. Perhaps it _can_ happen, but _would_ it. Various posters have alluded to the use of ptr being a possible problem after free(ptr). On reflection, I don't believe any useful architecture could have this restriction. If the very fact of having a non-valid address in an address register caused a violation, is it possible to implement free? Is anyone aware of a real example of such a problem architecture, current or historical? On the assumption that such an architecture does exist however, wouldn't it be trivial for its 'C' compiler to ensure that such an expression doesn't cause a problem, by, for example, doing the test using data registers rather than address registers (even though verbose code just might be necessary to achieve that)? Wouldn't the 'C' compiler be *expected* to do that? -- Ray Dunn. | UUCP: ..!uunet!philmtl!ray Philips Electronics Ltd. | TEL : (514) 744-8200 Ext: 2347 600 Dr Frederik Philips Blvd | FAX : (514) 744-6455 St Laurent. Quebec. H4M 2S9 | TLX : 05-824090