why does not "g++ -Wall" give warning message when compiling the following code?
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 10 楼,当前显示第 5 楼 : 从楼主开始阅读 : 本帖树形列表 : 返回上一页
作者:simon (等级:10 - 炉火纯青,发帖:6860) 发表:2005-10-30 11:16:41  5楼 
delete array; not delete [] array;delete [] arr; is equivalant to delete arr[0]; delete arr[1]; ... delete arr[k]; ------------------------------------------------ defination from msdn: The delete operator destroys the object created with new by deallocating the memory associated with the object. ------------------------------------------------ however your array is array of primative type bool now try this Class Bool { public bool myBool; }; Bool *flag2 = new Bool[8]; delete [] flat2;
different btw 'object' and 'primitive data type'

You may say I'm a dreamer
but I'm not the only one...
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表

本帖共有 10 楼,当前显示第 5 楼,本文还有 N-1 层楼,要不你试试看:点击此处阅读更多 >>



请登录后回复:帐号   密码