How dangerous is conversion from void ** to char **

c, pointers, void-pointers

Solution

`void *` and `char *` are guaranteed to have the same size.

`void **` is not guaranteed to have the same size as `char **` (but very likey on your implementation they will).

(C99, 6.2.5p27) "A pointer to void shall have the same representation and alignment requirements as a pointer to a character type [...] Pointers to other types need not have the same representation or alignment requirements."

Problem

So we know that the standard doesn't force pointer sizes to be equal. (here and here) (and not talking about function pointers) I was wondering how in reality that can be an issue. We know that `void *` can hold anything, so if the pointer sizes are different, that would be the biggest size. Given that, assigning a `void **` to a `char **` means trouble. My question is how dangerous would it be to assume `void *` and `char *` have the same size? Is there actually an architecture where this is not true? Also, 16-bit dos is not what I want to hear! ;)

Original source

Related problems