gpt4 book ai didi

c - 如何阅读类函数宏?

转载 作者:太空宇宙 更新时间:2023-11-04 03:21:23 25 4
gpt4 key购买 nike

我应该实现这些类似函数的宏,但我不确定我是否理解语法。有人可以向我解释如何阅读它们吗?

#define msgsend(dest, payload) (SYSCALL(SYS_SEND,(unsigned int) (dest), (unsigned int) (payload),0))

#define msgrecv(source, reply) (((struct tcb_t *) SYSCALL(SYS_RECV, (unsigned int) (source),(unsigned int) (reply),0)))

最佳答案

你定义了一个宏msgsend(dest, payload),它会被展开为

(SYSCALL(SYS_SEND,(unsigned int) (dest), (unsigned int) (payload),0))   

简化上面的行

SYSCALL(SYS_SEND, (unsigned int) (dest), (unsigned int) (payload), 0)

关于c - 如何阅读类函数宏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45823883/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com