Article # 55, added by Geoworks, historical record
| first | previous | index | next | last |

ECCheckBounds and ec flag settings.




Are you getting the ADDRESS_OUT_OF_BOUNDS error on the following code (or
something similar): 

    ptr = VMLock( fileHan, vmBlkHan, &memHan );
    ECCheckBounds( ptr );

or

    ptr = MemDeref( memHan );
    ECCheckBounds( ptr );

This probably happens because you have the lmem ec flag turned on. When
this ec flag is on, ECCheckBounds will do some extra checking. One of the
things it does to recognize the type of block the pointer points to. If
it's pointing to an lmem block then ECCheckBounds will make sure that the
pointer is pointing to either a chunk handle or a chunk. If it's not, it
is out of bounds. However, that may not be a problem for you if you have
some information at the beginning of the block that is internal to your
program. 

So, in summary, it may seem like a good idea to turn on these ec flags,
but be aware that not all errors you get are actually errors for what your
application is doing.