• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
sfesly
博客园 首页 新随笔 联系 订阅 订阅 管理

2015年12月23日

C++11 不抛异常的new operator
摘要: 在google cpp style guide里面明确指出:we don't use exceptionsC++11的noexcept关键字为这种选择提供了便利。C++11以前,提及malloc和new的区别,总是会强调由malloc返回的指针需要检查是不是null,因为空间分配可能失败,而由new... 阅读全文
posted @ 2015-12-23 16:09 sfesly 阅读(2402) 评论(0) 推荐(0)
 
In p = new Fred(), does the Fred memory “leak” if the Fred constructor throws an exception?
摘要: No.If an exception occurs during the Fred constructor of p = new Fred(), the C++ language guarantees that the memory sizeof(Fred) bytes that were allo... 阅读全文
posted @ 2015-12-23 14:58 sfesly 阅读(158) 评论(0) 推荐(0)
 
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3