Any pitfalls using char* instead of void* when writing cross platform code?
Posted
by
UberMongoose
on Stack Overflow
See other posts from Stack Overflow
or by UberMongoose
Published on 2012-10-24T04:57:27Z
Indexed on
2012/10/24
5:00 UTC
Read the original article
Hit count: 113
Is there any pitfalls when using char*'s to write cross platform code that does memory access?
I'm working on a play memory allocator to better understand how to debug memmory issues. I have come to believe char*'s are preferable because of the ability to do pointer arithmetic and derefernce them over void*'s, is that true? Do the following assumptions always hold true on different common platforms?
sizeof(char) == 1
sizeof(char*) == sizeof(void*)
sizeof(char*) == sizeof(size_t)
© Stack Overflow or respective owner