Re: Adding garbage collection to C++

jos@and.nl (Jos Horsmeier)
Fri, 14 Aug 1992 09:03:48 GMT

          From comp.compilers

Related articles
Adding garbage collection to C++ Dain.Samples@UC.EDU (1992-08-11)
Re: Adding garbage collection to C++ tmb@arolla.idiap.ch (1992-08-12)
Re: Adding garbage collection to C++ mw@ki.fht-mannheim.de (1992-08-13)
Re: Adding garbage collection to C++ kelvin@kickapoo.cs.iastate.edu (1992-08-13)
Re: Adding garbage collection to C++ fjh@cs.mu.OZ.AU (1992-08-14)
Re: Adding garbage collection to C++ jos@and.nl (1992-08-14)
Re: Adding garbage collection to C++ henry@zoo.toronto.edu (1992-08-14)
Re: Adding garbage collection to C++ bill@amber.ssd.csd.harris.com (1992-08-14)
Re: Adding garbage collection to C++ pardo@cs.washington.edu (1992-08-15)
Re: Adding garbage collection to C++ tmb@idiap.ch (1992-08-17)
Re: Adding garbage collection to C++ tmb@idiap.ch (1992-08-17)
Re: Adding garbage collection to C++ hudson@cs.umass.edu (1992-08-17)
[5 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: jos@and.nl (Jos Horsmeier)
Organization: AND Software BV Rotterdam
Date: Fri, 14 Aug 1992 09:03:48 GMT
References: 92-08-052 92-08-063
Keywords: C, GC

In article 92-08-063 the moderator appends:


|[It is my impression that an ANSI C program is allowed to copy a pointer to
|a long and later back to a pointer of the same type. This sort of thing
|makes it hard to find all the live data. -John]


True, all true, but you'd better not say these kind of things in
comp.std.c, they'll nail your head to the floor for this ;-)


A pointer is _not_ an integral number, it's not even an _address_.
Casting a pointer to and from an integral number type causes
implementation defined behavior. The only exception to the rule is the
number 0. [*] When casted to the appropriate pointer type, it yields a
value somewhere in memory where no object will ever be stored.


Since ANSI-C arrived, the concept of a pointer type has changed slightly.
In the good old days when things such as ints, longs, pointers and the
whole world could be stored in a 32 bit word, life was easy (boy, did I
love those VAXes,) but more esoteric hardware architectures nowadays
forbid such actions: pointers can be up to 256 bits wide, pointers can be
some `magical' thingies, stored in a separate space in your machine etc.
They are _not_ numbers. IMHO the concept of a pointer can be explained by
looking upon them as a tuple: and address with some type information
attached to it. As the standard states it:


ANSI-C 3.1.2.5 Types


[ ... ] A pointer type may be derived from a function type, an object
type, or an incomplete type, called the referenced type. A pointer type
describes an object whose value provides a reference to an entity of the
referenced type. A pointer type derived from the referenced type T is
sometimes called `pointer to T.' [ ... ]


Sorry if I sounded pedantic about it ...


kind regards,


Jos aka jos@and.nl


[*] The compiler provides the appropriate cast here, i.e. during runtime,
        the following code is not conformant, i.e. the resulting value is
        _not_ necessarily a NULL pointer value.


        char* p;
        long i;


        i= 0;
        p= (char*)i;
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.