_CrtIsValidPointer() crippled in VS 2005 ??

Giganews Newsgroups
Subject: _CrtIsValidPointer() crippled in VS 2005 ??
Posted by:  jhey (jodyh…@yahoo.com)
Date: Fri, 17 Jul 2009

I'm running vs 2005 professional and coding in c.

dbgheap.c  has a function for debugging read/writes that may not refer
to valid heap locations

Here is the description from the run-time library reference for
MS.VSCC.v80
_CrtIsValidPointer returns TRUE if the specified memory range is valid
for the specified operation or operations. Otherwise, the function
returns FALSE.

Here is the description in dbgheap.c
/***
*int _CrtIsValidPointer() - verify memory range is valid for reading/
writing
*
*Purpose:
*      verify memory range range is valid for reading/writing
*
*Entry:
*      const void * pv    - start of memory range to test
*      unsigned int nBytes - size of memory range
*      int bReadWrite      - TRUE if read/write, FALSE if read-only
*
*Return:
*      TRUE - if valid address
*      FALSE otherwise
*
*******************************************************************************/

Here is the actual source code:

extern "C" _CRTIMP int __cdecl _CrtIsValidPointer(
        const void * pv,
        unsigned int nBytes,
        int bReadWrite
        )
{
        return (pv != NULL );
}

So far as I can tell,  the actual function only checks for a null
pointer.

Am I missing something?  The microsoft site,  and the documentation,
all tout using _CrtIsValidPointer()  for debugging heap problems.

thanks

jhey

Replies