I have a code that is accessing specific memory and writing to it :
*addr = _data;
but there are cases, in which addr
variable can point to inaccessible memory, that cannot be read or written to (for instance, nullptr
). In such case the code above should not be executed. The question is, how do i check if a memory address in addr
is valid? I have learned that i cannot catch Access violation exceptions, neither i can use IsBadReadPtr
WinAPI function, because it is basically useless. How should i check for such cases?