I really want to use some void casts to hold binary data but this is either g++ warning cascade or a lot
of casting. Is there an easy and safe way to do void pointer arithmetics in C++ (preferably c++11 or higher)?
I am working only on posix systems with gnu compiler so that not a problem here.
Usecase:
I have void * ptr to data with size > 1GB.
I have other function to do things, lets call it
stuff()
its part of external library and gets (void *, size_t) as params.stuff(ptr, n) is likely to mutate underlying memory. basically I need to pass slice of ptr*.
Code suppose to, is, and i guess, will not be portable.
I guess i will go just with -Wno-pointer-arithmetics if i wont be able to find some more elegant solution, but the one proposed in answers helped