首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

errno的地址是否会为NULL,该如何解决

2012-04-15 
errno的地址是否会为NULLextern int *__errno_location (void) __THROW __attribute__ ((__const__))#def

errno的地址是否会为NULL
extern int *__errno_location (void) __THROW __attribute__ ((__const__));
# define errno (*__errno_location ())

如上,是多线程版的errno定义,我理解errno是对函数指针__errno_location解引用,所以其应该不会为NULL,但是coverity检查说有这种可能,请高手看下,多谢

[解决办法]
是对函数返回的指针解引用。是否为NULL就看函数里面的实现咯
[解决办法]
"但是coverity检查说有这种可能"
因为
int *__errno_location()
返回的是一个指针。当然就有可能为NULL。

热点排行