Quoth adr <a...@sdf.org>: > Hi, > one of the first thing I noticed compiling in plan9 is that arithmetic > on void* is illegal. Other compilers treat void* as uchar*. > Conceptually, it makes sense. A pointer to void doesn't point to > any object. But then I've seen the use of void* in functions (like > memccpy) when the pointed object is going to be processed as a > byte array. Local uchar*'s are used to do the trick inside the > function. >
arithmetic on void* is a gnu extension. It also implies sizeof(void) == 1; this is indeed true with gcc. I also don't think it's useful enough to add a special case to an already special case: it's rare to be able to do pointer arithmetic on void and *not* access the memory, in my experience. > It wouldn't make more sense to avoid the use of void* > and just use instead uchar* or better still u8int*? the unique thing about void* is that there is an implicit conversion from any pointer type to void*; there is not for uchar* or u8int*. memset((u8int*)&x, 0, sizeof(x)); seems unnecessarily clunky. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tecaea3b9ec8e7066-Ma63068d9d401c85e69d9d87f Delivery options: https://9fans.topicbox.com/groups/9fans/subscription