本文介绍了C ++ 0x00000000处的未处理异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 你好,我正在试图找出这个未处理的异常的来源 (坏指针或未分配的内存) 我有一个父类, IOField具有以下指向函数的指针 bool(* isValid)(void * data,IOScreen * scrPtr); 它保存地址一个函数被设计为在编辑后验证IOField的 数据。 IOField显示在 IOSCreen中,由scrPtr指示。 现在稍后在子类中,我想要调用函数 isValid; if(isValid(data,this-> owner)== false)condition = true; 以前的函数为数据分配内存并在其中存储字符串, 和this->所有者在构造函数中设置。 数据和,this->所有者有一个地址,但isValid没有。 编译时,唯一的0x00000000地址是isValid; Visual Studio 2005报道, 数据0x00129ac8无效* +所有者0x0012920c {fnum = 15 row = 2 col = 5 ...} IOScreen * isValid 0x00000000 bool(void *,IOScreen *)* + this 0x00356b48 {flen = 20 slen = 40 curpos = 0 ...} IOLineEdit * const 也许我在指向函数时做错了,我d我有很多使用它们的经验(他们在这所大学里需要这些学生 )。 感谢任何帮助并提前感谢。Hello, I am trying to figure out the source of this unhandled exception(bad pointer or unallocated memory)I have a parent class, IOField with the following pointer to functionbool (*isValid)(void *data, IOScreen *scrPtr);This holds the address of a function that is desinged to validate thedata of an IOField after being edited. The IOField is displayed in anIOSCreen pointed by "scrPtr".Now later on in a child class, I want to make a function call toisValid;if(isValid(data,this->owner) == false) condition = true;Previous functions allocate memory for data and store strings in them,and this->owner is set in the constructor.data and, this->owner has an address but isValid does not.When compiling, the only address with 0x00000000 is isValid;Visual Studio 2005 reports,data 0x00129ac8 void *+ owner 0x0012920c {fnum=15 row=2 col=5 ...}IOScreen *isValid 0x00000000 bool (void *, IOScreen *)*+ this 0x00356b48 {flen=20 slen=40 curpos=0 ...}IOLineEdit * constMaybe I am doing something wrong with pointer to functions, I dont have*that* much experience using them (they are required in this collegeassignment).Appreciate any help and thanks in advance.推荐答案 你是否已初始化/为`isValid赋值''? (看起来好像是 你还没有。) 向我们展示你班级的施工人员,我们也许可以提供帮助。 HTH, -ag - Artie Gold - 奥斯汀,德克萨斯州 http://goldsays.blogspot.com (新帖子8/5 ) http://www.cafepress.com/goldsays "如果你没有什么可隐藏的,你就没有尝试!Have you initialized/assigned a value to `isValid''? (It sure looks likeyou haven''t.)Show us the constructors for your class and we might be able to help.HTH,--ag--Artie Gold -- Austin, Texas http://goldsays.blogspot.com (new post 8/5) http://www.cafepress.com/goldsays"If you have nothing to hide, you''re not trying!" 这个描述中无处可去你说你在哪里为isValid分配一个 地址。还可以通过调试器输出来判断isValid是否具有NULL的地址。您是否有可能忘记分配地址 isValid? 如果这没有帮助,那么从您的程序中删除所有无关的代码, 所以你有一个小但仍然可编译的程序仍然有这个问题,然后在这里发布整个代码。如果没有看到代码就很难解决 编码问题。 johnWell nowhere in this descrption have you said where you assign anaddress to isValid. Also judging by your debugger output isValid has anaddress of NULL. Is it possible you just forgot to assign an address toisValid?If this doesn''t help then remove all extraneous code from your program,so that you have a small but still compilable program which still hasthis problem, then post the entire code here. It''s difficult to solvecoding problems without seeing the code.john 这篇关于C ++ 0x00000000处的未处理异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 08:43
查看更多