home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.misc
- Path: sparky!uunet!pipex!warwick!nott-cs!piaggio!anw
- From: anw@maths.nott.ac.uk (Dr A. N. Walker)
- Subject: Re: Pointers
- Message-ID: <1992Nov5.153459.22708@maths.nott.ac.uk>
- Reply-To: anw@maths.nott.ac.uk (Dr A. N. Walker)
- Organization: Maths Dept., Nott'm Univ., UK.
- References: <1992Nov2.083810.1652@syacus.acus.oz.au> <Bx3BsH.I0J@mentor.cc.purdue.edu> <1992Nov3.130634.26112@rdg.dec.com> <1992Nov4.031026.23624@linus.mitre.org>
- Date: Thu, 5 Nov 1992 15:34:59 GMT
- Lines: 32
-
- In article <1992Nov4.031026.23624@linus.mitre.org>
- crawford@boole.mitre.org (Randy Crawford) writes:
- >The nice thing about C's low level programming support is that you
- >don't have to tolerate the imposition and girth of a garbage collector
- >(something that belongs in a library anyway). If you really want one,
- >once again, C will let you roll your own.
-
- No it won't. There is no way [provided by C -- an individual
- compiler or system may add one, of course] of finding out whether some
- object is being pointed at, so there is no way of determining which
- objects are "dead". There is no way of "compacting" live storage, and
- shifting all pointers to correspond. For specific applications, you can
- rig up versions of "malloc" and "free" to do this, but not in general.
-
- In languages that *do* provide proper garbage collection, it
- is usually included only if your program includes constructs that
- might cause it to be invoked -- in C terms, it might be a library
- procedure that was called by "malloc" -- which gets round your objection
- to its "imposition and girth" [whatever that means!].
-
- >If you want run-time error checking, then C is the wrong choice of
- >programming language for a lot of better reasons than array bounds
- >checking.
-
- Why? I quite like C, and it wouldn't make it any worse as a
- language if there was at least a compiler option [as indeed there is
- for *some* compilers] for array bound checking, pointer validity
- checking, etc.
-
- --
- Andy Walker, Maths Dept., Nott'm Univ., UK.
- anw@maths.nott.ac.uk
-