From mboxrd@z Thu Jan 1 00:00:00 1970 From: bakul@bitblocks.com (Bakul Shah) Date: Wed, 08 Nov 2017 13:25:35 -0800 Subject: [TUHS] origins of void* -- Apology! In-Reply-To: Your message of "Wed, 08 Nov 2017 17:44:50 +0000." <20171108174450.5564F20334@orac.inputplus.co.uk> References: <7617c69abf46fbe3f206c6208000fe3b26854359@webmail.yaccman.com> <065d01d3575e$f71f6ad0$e55e4070$@ronnatalie.com> <20171108174450.5564F20334@orac.inputplus.co.uk> Message-ID: <20171108212550.56005156E7D7@mail.bitblocks.com> On Wed, 08 Nov 2017 17:44:50 +0000 Ralph Corderoy wrote: Ralph Corderoy writes: > Hi Bakul, > > > void* serves a different purpose. It says this is an untyped pointer > > (or a ptr to an instance of any type) so no question of size being an > > issue. > > In C, ignoring POSIX, a void pointer is big enough to hold any pointer > to data. Pointers to data may be different sizes. And a void pointer > can't hold a function pointer, but all function pointers are defined to > be the same size. Thus `void (*)(void)' can be used as a generic > function pointer type and cast to other ones when needed. Yes, I was being sloppy, not mentiong the fn ptr exception. I was saying `void *' represents a generic non-function pointer. I was just separating it from what Ron wants, which is, if I understand right, is a pointer to the *smallest* addressable memory unit. I agree that `char' shouldn't do double duty as the smallest addressable unit and I was suggesing uint8_t does that job. But that is not true either. There are word addressable machines where you can't directly address bytes (if they have 8 bit bytes). Nor would you want a "byte pointer" to be a general pointer. > > It shouldn't even have been "void*". I would've preferred _* and _ > > instead of void* and void. Much more appropriate for a concise > > language like C! > > That's awful. Might as well say `return' occurs so often, it should > have been `@'. :-) Fits right in with "e1 ? e2 : e3" :-) My thinking was that the word void loses any meaning in "void *". It is a not a pointer to an empty space. Seems people just didn't want to add a new keyword so they reused void. _ is alreast more mnemonic.