From: Bakul Shah <bakul@iitbombay.org>
To: 9fans <9fans@9fans.net>
Subject: Re: [9fans] void*
Date: Sun, 15 May 2022 08:50:38 -0700 [thread overview]
Message-ID: <D451CE1D-F3B0-45CE-B33B-C61D57F45695@iitbombay.org> (raw)
In-Reply-To: <CAEoi9W7uMf+EU-869eyKZYc6ciBuVrKp2064Wt804C7DK_u3PQ@mail.gmail.com>
> On May 15, 2022, at 8:23 AM, Dan Cross <crossd@gmail.com> wrote:
>
> On Sun, May 15, 2022 at 9:16 AM adr <adr@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
next prev parent reply other threads:[~2022-05-15 15:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-15 10:58 adr
2022-05-15 12:11 ` Humm
2022-05-15 13:03 ` adr
2022-05-15 13:15 ` adr
2022-05-15 13:21 ` arnold
2022-05-15 14:09 ` adr
2022-05-15 14:47 ` ori
2022-05-15 15:49 ` adr
2022-05-15 15:23 ` Dan Cross
2022-05-15 15:50 ` Bakul Shah [this message]
2022-05-15 15:54 ` ori
2022-05-15 14:46 ` ori
2022-05-15 16:07 ` adr
2022-05-16 6:24 ` Skip Tavakkolian
2022-05-16 12:46 ` Humm
2022-05-16 13:23 ` Bakul Shah
2022-05-16 14:46 ` Charles Forsyth
2022-05-16 16:03 ` adr
2022-05-16 17:45 ` hiro
2022-05-17 4:00 ` Lucio De Re
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D451CE1D-F3B0-45CE-B33B-C61D57F45695@iitbombay.org \
--to=bakul@iitbombay.org \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).