Re: Pointer Pointing Itself
- From: Jon Harrop <jon@xxxxxxxxxxxxxxxxx>
- Date: Mon, 06 Nov 2006 01:43:24 +0000
pete wrote:
wade@xxxxxxxxxx wrote:
KBG wrote:
where could [a pointer pointing at itself] be this used ?
char* a = 0; /* no string */
char* b = ""; /* empty string */
void* c = 0; /* no list */
void* d = &d; /* empty list */
I consider a null pointer to be an empty list,
that is to say, a list with zero number of nodes.
I don't see any point in distinguishing "empty list" from "no list".
I don't think "d" is an empty list, I think it is a cyclic list of no
values. In OCaml, the equivalent is:
type t = Nil | Cons of t
--
Dr Jon D Harrop, Flying Frog Consultancy
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists
.
- References:
- Pointer Pointing Itself
- From: KBG
- Re: Pointer Pointing Itself
- From: wade
- Re: Pointer Pointing Itself
- From: pete
- Pointer Pointing Itself
- Prev by Date: Re: What is the best way to increase my income?
- Next by Date: Re: Pointer Pointing Itself
- Previous by thread: Re: Pointer Pointing Itself
- Next by thread: Re: Pointer Pointing Itself
- Index(es):
Relevant Pages
|