The Question is:
To avoid "Access violation" due to a corrupted address pointer ( in C program )
I am looking for some thing to test an address is addressable .
Thank you in advance.
Cheu (Ex-Digitalian )
The Answer is :
The usual approach for handling an access violation on OpenVMS is to
simply try the access and to catch any access violation that might
arise via a condition handler. You can then ignore the reference,
reload and restart the attempt, resignal, or take other appropriate
action, based on the signal and mechanism arrays available within the
condition handler routine.
Pre-emptive testing for (same access mode) memory accessability -- like
testing for access to security-relevent system objects, and then trying
the access to the object -- is generally error-prone, wasteful, and
inappropriate. Simply try it, and catch any errors that might occur.
The OpenVMS Wizard will assume you also realize that a corrupted pointer
can be corrupted to a valid address, one that is accessable but that
contains incorrect or unexpected contents.
Privileged code (inner access modes) should obviously probe the
arguments and the memory referenced by the arguments for access by
the calling mode -- this is one of the few cases where the OpenVMS
Wizard does recommend pre-emptive memory access testing.