Oracle® Developer Studio 12.5 发行版的新增功能

退出打印视图

更新时间: 2016 年 7 月
 
 

数学库更改

在 Oracle Solaris Studio 12.4 和编译器的早期发行版中,<sunmath.h> 头文件包括要从 Fortran 调用的“包装”函数的 C/C++ 原型,以调用 libsunmath 中的多个非标准数学函数和浮点实用程序例程。这些“包装”函数本身就可以调用可从 C/C++ 直接调用的相应函数,因此 C/C++ 程序没有必要使用它们。例如,“包装”函数 r_atan2d_ 等效于 C 函数 atan2df

在 Oracle Developer Studio 12.5 中,“包装”函数已过时。其在 <sunmath.h> 中的原型现在由预处理器宏 __SUNMATH_DEPRECATED 保护;在 C 程序中使用这些函数会生成警告:

example% cat func.c
    #include <sunmath.h> 
    float func(float x, float y) {  
        return r_atan2d_(&x, &y); 
    }
    example% cc -c func.c 
    "func.c", line 4: warning: implicit function declaration:
    r_atan2d_ 
    example% 

所生成的程序可能会产生错误结果。应将此类程序重写为直接使用相应的 C 函数:

return atan2df(x, y);

另外,可以在包含 <sunmath.h> 之前添加 #define __SUNMATH_DEPRECATED prior,或将 -D__SUNMATH_DEPRECATED 添加到在命令行上指定的编译器标志,但是请注意,“包装”函数在未来的发行版中将被删除。