【发布时间】:2013-06-23 06:52:52
【问题描述】:
为什么在这里使用三个 * ? (glibc源代码glibc-2.9/sysdeps/mach/bits/libc-lock.h第81行)
在线查看libc-lock.h代码->http://www.oschina.net/code/explore/glibc-2.9/sysdeps/mach/bits/libc-lock.h
/* Start a critical region with a cleanup function */
#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
{ \
typeof (***(FCT)) *__save_FCT = (DOIT) ? (FCT) : 0; \
typeof (ARG) __save_ARG = ARG; \
/* close brace is in __libc_cleanup_region_end below. */
/* End a critical region started with __libc_cleanup_region_start. */
#define __libc_cleanup_region_end(DOIT) \
if ((DOIT) && __save_FCT != 0) \
(*__save_FCT)(__save_ARG); \
}
不知道这里为什么用3 *,为什么不用
typeof (*(FCT)) * __save_FCT = (DOIT) ? (FCT) : 0;
提前致谢。
【问题讨论】:
-
因为它可能意味着不同的东西?
-
它是否返回一个指向指针的指针?
-
如果我在以单指针形式给出时没有错,那么在使用
__save_FCT时可能会收到编译器警告。因为当FCT是****类型时,__save_FCT应该是单指针。否则当给定为(*(FCT))时,__save_FCT将成为三重指针。 - 这是我的猜测。