Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!spool.mu.edu!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: "void **" : Is it valid and what does it mean? Message-ID: <6001@goanna.cs.rmit.oz.au> Date: 28 May 91 07:17:22 GMT References: Distribution: comp Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 45 Yes, void ** is valid, and it means pointer-to-generic pointer. Note that void ** itself may be represented some other way entirely; void ** is not itself a generic pointer. In article , aj3u@jade.cs.virginia.edu (Asim Jalis) writes: > func(void **p) > { ... } > > main() > { int *i; float *f; char *c; > > func(&i); func(&f); func(&c); > } > > However, the compiler gives me warnings about incompatible type for > all the function calls. The compiler is RIGHT. You promised it (oh, you deceiver) that you would give func() pointers to generic (void*) pointers (call the representation of generic pointers REPRESENTATION 0) But you lied (oh, you scoundrel, you). You gave it -- a pointer to (a pointer to int -- REPRESENTATION 1) -- a pointer to (a pointer to float -- REPRESENTATION 2) -- a pointer to (a pointer to char -- REPRESENTATION 0) char* and void* use the same representation. But void*, int*, and float* need not even be the same _size_, let alone use the same physical representation. > The code itself works fine, no, there is a bug in there, waiting, like a blood-sucking insect poised on a bush waiting for a deer to pass by, for an opportunity to bite. > Basically what I want is a type that would coerce to a pointer to a > pointer to a type, for any type. Sort of one level beyond simple > "void *". Why do you want to do _that_? If you _could_ do it, you would be throwing away information that the receiver would need in order to be able to _use_ the thing? What's the context? -- Should you ever intend to dull the wits of a young man and to incapacitate his brains for any kind of thought whatever, then you cannot do better than give him Hegel to read. -- Schopenhauer.