zoukankan      html  css  js  c++  java
  • _THROW 何解?

    在看/usr/include/........中.h头文件对函数接口的定义时,总是能看到在函数结尾加一个_THROW,一时不明白这是什么意思,而且对于有些POSIX和ISO C不承认或未明确的定义的函数不加_THROW,注释中也会特别说明,该函数不会抛THROW,所以查了一下,

    这是一个宏定义,是在GNU下的特色。在头文件#include <cdefs.h>中定义:

    # if !defined __cplusplus && __GNUC_PREREQ (3, 3)
        #  define __THROW   __attribute__ ((__nothrow__))
        #  define __NTH(fct)    __attribute__ ((__nothrow__)) fct
        # else
        #  if defined __cplusplus && __GNUC_PREREQ (2,8)
        #   define __THROW  throw ()
        #   define __NTH(fct)   fct throw ()
        #  else
        #   define __THROW
        #   define __NTH(fct)   fct
        #  endif
        # endif


    C语言下为 __attribute__ ((__nothrow__))__nothrow__表示该函数不会抛出异常,但是在C++中就会定义为throw(),C++异常有关。


  • 相关阅读:
    镜像源收集
    关于vue-cli3脚手架安装后回退到vue-cli2版本的问题
    window.location 对象
    常用正则表达式
    前端开发工程师面试题
    面试题1
    Echarts.js使用
    swipe.js 使用方法
    canvas基础API
    前端面试题集锦
  • 原文地址:https://www.cnblogs.com/webber1992/p/5850758.html
Copyright © 2011-2022 走看看