码迷,mamicode.com
首页 >  
搜索关键字:dangling pointer    ( 2210个结果
Effective C++ Item 28 避免返回对象内部数据的引用或指针
经验:避免返回handles(包括 references、指针、迭代器)指向对象内部。遵守这个条款可增加封装性, 帮助 const 成员函数的行为像个 const,并将发生“虚吊号码牌”(dangling handles)的可能性降至最低。 示例: class Point{ public: Point(int x, int y); //... void setX(int newVal); void setY(int newVal); //... }; struct RectData{ Point...
分类:编程语言   时间:2014-07-10 22:56:05    阅读次数:230
Effective C++ Item 25 考虑写出一个不抛异常的swap函数
经验:当std::swap对你的类型效率不高时,提供一个swap成员函数,并确定这个函数不抛出异常 示例: stl里的swap算法 namespace std{ template void swap(T &a, T &b){ T temp(a); a = b; b = temp; } } //“pimpl手法”(pointer to implementation) --> 文件间的编译依存度 class WidgetImpl{ public: //... pr...
分类:编程语言   时间:2014-07-10 19:35:50    阅读次数:240
关于DELPHI数组,指针,字符串转换的例子!(转)
var aa: array [0..5] of Char; bb:Pointer; cc:string; dd:PChar;procedure TForm1.Button1Click(Sender: TObject);begindd:='abcdef'; //以下是pchar内容转数组FillCha...
分类:其他好文   时间:2014-07-06 21:56:57    阅读次数:264
VC++ CopyFile函数使用方法
BOOL CopyFile( LPCTSTR lpExistingFileName, // pointer to name of an existing file LPCTSTR lpNewFileName, // pointer to filename to copy to BOOL bFailI...
分类:编程语言   时间:2014-07-05 17:16:57    阅读次数:275
[leetcode] Populating Next Right Pointers in Each Node
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
分类:其他好文   时间:2014-07-03 23:46:37    阅读次数:389
垃圾回收(garbage collection)介绍
?? 垃圾回收用来实现内存的自动管理(automatic management),区别于人工管理(manual management)。人工管理内存容易出现的问题: 1)悬垂指针,dangling pointer 2)重复回收,Double free 3)内存泄露,memory leak 历史 垃圾回收的概念及技术由John McCarthy于1959年发明,应用于List...
分类:其他好文   时间:2014-07-03 16:34:03    阅读次数:194
c/c++:回调函数
1:函数名为指针 首先,在C语言中函数是一种function-to-pointer的方式,即对于一个函数,会将其自动转换成指针的类型.如: 1 #include 2 3 void fun() 4 { 5 } 6 7 int main() 8 { 9 printf("%p %p %p\n", &fun, fun, *fun); 10 return 0...
分类:编程语言   时间:2014-07-03 13:30:17    阅读次数:363
连接符
#define BTS_SAFE_DELETE(POINTER) \do { if (POINTER != 0) { BTS_DELETE(POINTER); POINTER = 0;} \} while (0)注意:宏定义必须在一行,否则报错!\ 表示本行未结束, 没有该连接符时,直接换行编译器会...
分类:其他好文   时间:2014-07-03 10:25:27    阅读次数:186
一些初级Java错误,不定期增加
1. Error: Dangling meta character '*' near index 0对字符串使用split()方法截取 * ? + / | 等字符的时候会报以下异常 Dangling meta character '?' near index 0 ?+、*、|、\等符号在正则表达示中...
分类:编程语言   时间:2014-07-03 07:13:36    阅读次数:222
VC中常见编译错误[转]
VC中常见编译错误(转载看看)1)disable#pragma warning (disable: 4311 4312) //指针类型强制转化,大小不完全匹配warning C4311: ''type cast'' : pointer truncation from ''TriNode *const...
分类:其他好文   时间:2014-07-03 07:01:57    阅读次数:214
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!