测试不等于NULL的错误指针
来源:互联网 发布:高中语文知乎 编辑:程序博客网 时间:2024/05/18 19:46
AfxIsValidAddress
Visual Studio 2005
Other Versions
Tests any memory address to ensure that it is contained entirely within the program's memory space.
BOOL AfxIsValidAddress( const void* lp, UINT nBytes, BOOL bReadWrite = TRUE );
Parameters
- lp
Points to the memory address to be tested.
- nBytes
Contains the number of bytes of memory to be tested.
- bReadWrite
Specifies whether the memory is both for reading and writing (TRUE) or just reading (FALSE).
In debug builds, nonzero if the specified memory block is contained entirely within the program's memory space; otherwise 0.
In non-debug builds, nonzero if lp is not NULL; otherwise 0.
The address is not restricted to blocks allocated by new.
// Allocate a 5 character array, which should have a valid memory address.char *array = new char[5];// Create a null pointer, which should be an invalid memory address.char *null = (char *)0x0;bool Test1 = AfxIsValidAddress(array, 5);bool Test2 = AfxIsValidAddress(null, 5);
Test1 等于true 即为有效指针
Test2 等于false 即为无效指针
- 测试不等于NULL的错误指针
- c++中未初始化的指针不等于NULL
- 简述一个关于null的理解误区:null不等于null
- MySql的简单查询不等于,NULL
- orale null 测试 and 关于Oracle中的不等于号
- 访问 NULL 指针错误背后的原理
- 测试指针NULL
- NULL不等于“ ”空字符串
- Java中null不等于任何非空的对象
- php 语法里0不等于null为空的解决办法
- 简述一个关于null的理解误区:null不等于null--【叶子】
- 数组不等于指针
- 数组名不等于指针
- Sql 中 不等于'<>'与 NULL
- Sql 中 不等于'<>'与 NULL
- Sql 中 不等于'<>'与 NULL
- oracle 中 不等于 和 null
- Sql 中 不等于'<>'与 NULL
- QT 学习记录:渐变-QLinearGradient,QRadialGradient,QConicalGradient)
- COM+ 进程内服务器接口指针的传递
- UVA 10817 Headmaster's Headache
- 打开word2007时总是出现配置进度,怎么解决?
- C/C++中extern关键字详解
- 测试不等于NULL的错误指针
- hdu - 3460 - Ancient Printer(Trip)
- 为什么移动Web应用程序很慢(译)
- SELinux架构
- AS3.0实现播放视频flv
- 11.2.0.3 - OCM: ORA-12012 and ORA-29280
- iPhone 和Android应用,特殊的链接:打电话,短信,email;
- C++中的函数指针和函数对象总结
- JSP页面显示绝对路径图片问题