请问g_likely的用法

wslium 2009-07-20 02:59:21
G_LIKELY ()这个宏怎么用的 ,用在哪些地方 具体是什么意思 用过的 指教下 谢谢~
...全文
144 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ho121 2009-07-20
  • 打赏
  • 举报
回复
The G_LIKELY and G_UNLIKELY macros let the programmer give hints to
the compiler about the expected result of an expression. Some compilers
can use this information for optimizations.
Nio96 2009-07-20
  • 打赏
  • 举报
回复
up
DarkChampion 2009-07-20
  • 打赏
  • 举报
回复
Hints the compiler that the expression is likely to evaluate to a true value. The compiler may use this information for optimizations.

if (G_LIKELY (random() != 1))
g_print ("not one");

70,023

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧