On Mon, 16 May 2022, Charles Forsyth wrote:
it's void* because that can be assigned between other pointer types without a cast.x = malloc(sizeof(*x)); instead of x = (T*)malloc(sizeof(*x)); which just adds clutter. Similarly it's just free(x) instead of free((void*)x); (or free((uchar*)x) as I understand your suggestion).
The idea I wanted to share, more as a light chat than as a suggestion is that I would find more useful to have a generic pointer (with the property you have just described) with size (the object pointed to) of 1. I don't expect anyone to be happy about substituting void*. GNU (and I think clang followed suit) just made the size of void* 1. I don't really like this because it breaks the concept of void, that's the reason I talk about char* and uint8*. But I think I'm repeating my self a lot, so I will silently retreat back through the hedge. Regards, adr. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tecaea3b9ec8e7066-M95c0625b8879224f86e28cd8 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription