F
Francis Moreau
Hello,
I have some stupids questions about void type and pointer to void.
Actually I've always known the answers but I wanted to find the
revelant parts in the C specs and fails.
The first one is about dereferencing a void pointer. It's just
forbidden but when reading 6.5.3.2 about indirection operators, I
can't find anything that states it.
The second one is about arithmetic on void *. I read section 6.5.6
about Additive operators but it doesn't state that arithmetic on void
* is forbidden. I thought that was the case since void * is a pointer
to an incomplete type.
The last question is about the section 6.2.5.26 which states: "A
pointer to void shall have the same representation and alignment
requirements as a pointer to a character type.". I'm not sure to
understand why the spec speaks about alignement requierements since a
pointer to void cannot be dereferenced.
Thanks for help.
I have some stupids questions about void type and pointer to void.
Actually I've always known the answers but I wanted to find the
revelant parts in the C specs and fails.
The first one is about dereferencing a void pointer. It's just
forbidden but when reading 6.5.3.2 about indirection operators, I
can't find anything that states it.
The second one is about arithmetic on void *. I read section 6.5.6
about Additive operators but it doesn't state that arithmetic on void
* is forbidden. I thought that was the case since void * is a pointer
to an incomplete type.
The last question is about the section 6.2.5.26 which states: "A
pointer to void shall have the same representation and alignment
requirements as a pointer to a character type.". I'm not sure to
understand why the spec speaks about alignement requierements since a
pointer to void cannot be dereferenced.
Thanks for help.