Size of () type in *mut ()


#1

Hi,

Couldn’t find this in reference.
In particular, if I have

let mut pointer: *mut () = some_pointer_returner();
pointer = pointer.offset(1);

will it be moved by 1 byte? Or some other value?

Thanks


#2

The Rustinomicon has a chapter on zero sized types.


#4

Thanks for help.

I read Rustonomicon though I somehow missed that () is zero-sized.
Guess I should use *u8 for raw pointers instead :smile:


#5

If you’re interfacing with C, use libc’s c_void (unless you’re actually handling bytes).


#6

I’m actually juggling with bytes, so it should be u8 I think