VS2005编译器的改进后,有些可能引起内存越界的函数不被推荐了
2005-05-14 00:20
399 查看
char c[10];
strcpy(c, "testtestts"); //ok with VC6, but not in VS2005
strcpy_s(c, _countof(c),"testtestt");//9 chars, ok in VS2005
strcpy_s(c, _countof(c),"testtestte");//10 chars, assert!!!!! in VS2005
and, _countof is a new macro supported in VS2005
strcpy(c, "testtestts"); //ok with VC6, but not in VS2005
strcpy_s(c, _countof(c),"testtestt");//9 chars, ok in VS2005
strcpy_s(c, _countof(c),"testtestte");//10 chars, assert!!!!! in VS2005
and, _countof is a new macro supported in VS2005
相关文章推荐
- VS2005编译器的一点改进 之 函数指针
- iOS中文输入法的键盘上有联想、推荐的功能,所以可能导致文本内容长度上有些不符合预期,导致越界
- 回调函数: 一定要在函数名前加上 CALLBACK,否则有可能引起内存崩溃!
- VS2005编译器的一点改进 之 函数指针
- /MT、/MD编译选项,以及可能引起在不同堆中申请、释放内存的问题
- 内存越界引起的bug汇总
- 【并发】ThreadLocal可能引起的内存泄露
- Android 中 Handler 引起的内存泄露 在Android常用编程中,Handler在进行异步操作并处理返回结果时经常被使用。其实这可能导致内存泄露,代码中哪里可能导致内存泄露,又是如何
- Android必知必会-Handler可能引起的内存泄露
- ThreadLocal可能引起的内存泄露
- ThreadLocal可能引起的内存泄露
- ThreadLocal可能引起的内存泄露
- MySQL 内存交换区引起的一场“血案” 推荐
- Android必知必会-Handler可能引起的内存泄露
- ThreadLocal可能引起的内存泄露
- memset内存越界导致函数堆栈崩溃的例子
- /MT、/MD编译选项,以及可能引起在不同堆中申请、释放内存的问题
- ThreadLocal可能引起的内存泄露
- /MT、/MD编译选项,以及可能引起在不同堆中申请、释放内存的问题
- 使用_snscanf_s转换十六进制时引起的内存越界