__THROW __nonnull

__THROW __nonnull ,不抛出异常和不让参数为空。

Linux 下的例子: 

/usr/lib/string.h 
string.h:

char *strcpy (char *__restrict __dest, __const char *__restrict __src)
      __THROW __nonnull ((1, 2));

/usr/src/linux-2.6.0-test3/lib/string.c 

/**
* strcpy - Copy a %NUL terminated string
* @dest: Where to copy the string to
* @src: Where to copy the string from
*/
char * strcpy(char * dest,const char *src)
{
         char *tmp = dest;
         while ((*dest++ = *src++) != '\0')
                 /* nothing */;
         return tmp;
}
在 string.h 中有 __THROW 这个宏,我们来查看一下在哪里定义的: 
$ grep __THROW /usr/include/*.h |grep define 
...
usr/include/malloc.h:#   define __THROW throw ()
...

而且几乎每个预处理指令都由 __THROW 来处理,可以这样查看: 

$ grep -R __THROW /usr/include/* | grep "#" 

你可能感兴趣的:(__THROW __nonnull)