> On May 15, 2022, at 8:23 AM, Dan Cross <cro...@gmail.com> wrote:
> 
> On Sun, May 15, 2022 at 9:16 AM adr <a...@sdf.org> wrote:
> On Sun, 15 May 2022, adr wrote:
> > What I mean is if we are going to follow C99 in the use of void*,
> > we should allow arithmetic on them.
> 
> Let me be clear, I know that C99 requires the pointer to be a
> complete object type to do arithmetic, and I like that, is consistent.
> But then I don't see the point to use void* as a generic pointer.
> 
> I confess that I am confused about what, precisely, you are asking for.
> 
> You are correct that standard C only allows arithmetic on pointers to 
> complete object types. But `void *` is not a pointer to a complete object 
> type, and so therefore pointer arithmetic on pointers of type `void *` is 
> illegal. So in that sense, Plan 9 C is already following C99.
> 
>         - Dan C.

Can't quote chapter and verse but AFAIK standard C allows +/- on void*.
So for example the following is legal:

void*f(void*x){return x+1;}

The returned value will be one more than the arg.


------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tecaea3b9ec8e7066-M57ca9f2db655438f69c42dbf
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to