volatile
seems to be a never ending question of every one. I thought I knew everything about it, but then I encountered this:
So, I have a piece of memory s
My conclusion was that just casting the pointer to void *
would not cause a problem and the fact that free
and vfree
don't directly accept pointers to volatile
data is just something that was overlooked.
The vfree
function (and every sane deallocation function in general) does not care about your actual data (be it volatile
or not). It just expects a (valid) pointer (think: passing the pointer as a long
value in a CPU register).
Based on that value, the function will:
So yes, casting to a void *
will not cause any harm at runtime.