Size of () type in *mut ()

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

The Rustinomicon has a chapter on zero sized types.

3 Likes

Thanks for help.

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

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

2 Likes

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