[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Language War (Re: "C" Manual)



On Tue, Jan 01, 2002 at 10:12:09AM -0600, Richard Cobbe wrote:
> 
> > Secondly, you can make this mistake with any language that allows
> > references (perl, python, and java all allow it). Just replace free()
> > with some other assignment that changes what a is, and ultimately you
> > change b, which referenced it, unintentionally.
> 
> True.  That, however, is not a type error of the sort that I'm
> describing.  And, in any case, the behavior of the program in that
> situation is well-defined by the language specification.  This is *not*
> the case with C or C++.

Of course it is defined. It says that after you free() an allocation,
that the memory the pointer references is gone and using the pointer
afterwards is undefined.

Saying it is undefined is as good as defining the behavior. Assuming
anything after that point is broken.

-- 
 .----------=======-=-======-=========-----------=====------------=-=-----.
/                   Ben Collins    --    Debian GNU/Linux                  \
`  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'



Reply to: