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 obje
one of the first thing I noticed compiling in plan9 is that arithmetic
on void* is illegal.
That’s what the standard says.
While Plan 9 C doesn’t pretend to be compliant, the core language does
roughly match C89 with a few C99 extensions.
Other compilers treat void* as uchar*. Conceptually,
What I mean is if we are going to follow C99 in the use of void*,
we should allow arithmetic on them. If not, there is not point to
use void* as char*, just use char* as the generic pointer. When I
ask something here about the Plan9 compilers, I'm not asking about
some committee's standard, I have
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 po
adr 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.
>
On Sun, 15 May 2022, arn...@skeeve.com wrote:
It allows you pass pointers of any type without requiring casts:
struct foo s[5] = ...
memmove(s, & s[1], 4 * sizeof(struct foo)); // shift down 1
The compiler won't complain because any pointer type can be passed
to a void* param
Quoth adr :
> 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
Quoth adr :
> On Sun, 15 May 2022, arn...@skeeve.com wrote:
>
> > It allows you pass pointers of any type without requiring casts:
> >
> >struct foo s[5] = ...
> >memmove(s, & s[1], 4 * sizeof(struct foo)); // shift down 1
> >
> > The compiler won't complain because any pointer
On Sun, May 15, 2022 at 9:16 AM adr 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
On Sun, 15 May 2022, o...@eigenstate.org wrote:
On Sun, 15 May 2022, arn...@skeeve.com wrote:
It allows you pass pointers of any type without requiring casts:
struct foo s[5] = ...
memmove(s, & s[1], 4 * sizeof(struct foo)); // shift down 1
The compiler won't complain becaus
> On May 15, 2022, at 8:23 AM, Dan Cross wrote:
>
> On Sun, May 15, 2022 at 9:16 AM adr 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 poi
Quoth Bakul Shah :
> void*f(void*x){return x+1;}
$ echo 'void*f(void*x){return x+1;}' > test.c
$ cc -pedantic -std=c99 test.c
test.c:4:24: warning: arithmetic on a pointer to void is a GNU
extension [-Wpointer-arith]
void*f(void*x){return x+1;}
In case someone is asking why this guy is suddenly so thoughtful
about void pointers, it is because I'm porting Ali Gholami Rudi's
neatroof, and he uses a lot of arithmetics with void* in neatmkfn.
I got rid of ape, and this troff looks really easy to port and has
a lot of features. I'll share it
If void can have a size, why not 4, 8 or 16?
P.S. I discovered Gholami Rudi's work a little while ago. I was especially
intrigued by Farsi support in neatroff (intro in Farsi produced by Neatroff
and Neatpost: https://litcave.rudi.ir/neatfarsi.pdf) Cool stuff.
On Sun, May 15, 2022, 9:09 AM adr
14 matches
Mail list logo