如果我们new出来的指针是一个基本类型,没什么关系,内存还是会被释放的,但是如果是一个类对象指针,在处理过程中转成了void*,那就有问题了,析构函数将不会被调用。
故new的指针类型要和delete的指针类型要保持一致。

如下所示:

object* p=new object[10];

void* p2=(void *)p;

//注意指针转换

delete[] (object*) p;

warning: deleting 'void *' is undefined 错误的更多相关文章

  1. JS魔法堂:从void 0 === undefined说起

    一.前言 当使用coffeescript书写如下代码时 name = person?.name 会被预编译为 ; ,那么void 0到底是什么意思呢?运行得知void 0===undefined为tr ...

  2. [转载][jQuery] Cannot read property ‘msie’ of undefined错误的解决方法

    参考 [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法 ---------------------------------------- ...

  3. [jQuery1.9]Cannot read property ‘msie’ of undefined错误的解决方法

    原文:[jQuery1.9]Cannot read property 'msie' of undefined错误的解决方法 $.browser在jQuery1.9里被删除了,所以项目的js代码里用到$ ...

  4. [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法 --转

    初用Yii的srbac模块.出现 Cannot read property ‘msie’ of undefined 错误.上网查询,找到如下的文章.使用文末的打补丁的方法,成功搞定.感谢. ===== ...

  5. Warning: Division by zero in 错误处理

    Warning: Division by zero in 错误处理 今天调试一段代码,结果提示 Warning: Division by zero in ,没有扫到答案,最后发现 $dir/$name ...

  6. iOS编译错误#ld: warning: ignoring file# 之 Undefined symbols for architecture x86_64 - ld: symbol(s) not found for architecture x86_64

    ld: warning: ignoring file xxxPath/libbaidumapapi.a, missing required architecture x86_64 in file xx ...

  7. d is undefined错误

    如图这样的错误:TypeError : d is undefined,今天早上在写代码的时候也是遇见这样的错误,报告的错误是jquery.js中错误,但是这样的问题经常是由于什么名字不对(个人见解), ...

  8. PHP pear安装出现 Warning: require_once(Structures/Graph.php)...错误

    今天在WINDOWS安装pear,一路无阻很顺利安装完成,接着想安装下pear email包来玩下,但接下来却报: Warning: require_once(Structures/Graph.php ...

  9. npm ERR! Cannot read property 'match' of undefined 错误处理

    跟往常一样运行npm install 的时候,突然报错.错误情况如下: npm ERR! Cannot read property 'match' of undefined npm ERR! A co ...

随机推荐

  1. HDU-5728-PowMod-求phi(i*n)前缀和+指数循环节

    HDU-5728-PowMod-求phi(i*n)前缀和+指数循环节 [Problem Description] 令\(k=\sum_{i=1}^m \varphi(i\cdot n)\ mod \ ...

  2. re模块及其用法

    一.re模块下的常用方法 首先在使用re模块之前,需要引入re模块 import re 1.与查找相关的: 1.findall 返回列表,找到所有的匹配项 ret = re.findall(" ...

  3. Bcompare 提示 “这个授权密钥已被吊销” 解决方法

    Bcompare 提示 “这个授权密钥已被吊销” 解决方法 打开文件夹 %appdata%\Scooter Software 找到相应的版本,例如 Beyond Compare 3 删除里面的 BCS ...

  4. Return local beginning of day time object in Go

    Both the title and the text of the question asked for "a local [Chicago] beginning of today tim ...

  5. 301、404、200、304等HTTP状态

    在网站建设的实际应用中,容易出现很多小小的失误,就像mysql当初优化不到位,影响整体网站的浏览效果一样,其实,网站的常规http状态码的表现也是一样,Google无法验证网站几种解决办法,提及到由于 ...

  6. html 实现动态在线预览word、excel、pdf等文件(方便快捷)

    https://blog.csdn.net/superKM/article/details/81013304 太方便了 <iframe src='https://view.officeapps. ...

  7. 4.Python 进制和位运算

    .button, #logout { color: #333; background-color: #fff; border-color: #ccc; } span#login_widget > ...

  8. The 2019 China Collegiate Programming Contest Harbin Site K. Keeping Rabbits

    链接: https://codeforces.com/gym/102394/problem/K 题意: DreamGrid is the keeper of n rabbits. Initially, ...

  9. 三十八. 分库分表概述 配置mycat

    1.搭建mycat 分片服务器   数据库主机 192.168.4.55 使用db1库存储数据 数据库主机 192.168.4.56 使用db2库存储数据 主机 192.168.4.54 运行myca ...

  10. 使用webuploader实现大文件上传

    javaweb上传文件 上传文件的jsp中的部分 上传文件同样可以使用form表单向后端发请求,也可以使用 ajax向后端发请求 1.通过form表单向后端发送请求 <form id=" ...