什么时候用 typedef

最近 NetBSD 里将大量的struct device *device_t代替,但没有怎么说明原因。

只记得在 Linux Kernel Coding Style 中对 typedef 还是不怎么提倡使用的,于是又重新翻了一下这份文档,发现这大概和下面这种情况比较相符:

totally opaque objects (where the typedef is actively used to hide what the object is). Example: "pte_t" etc. opaque objects that you can only access using the proper accessor functions. NOTE! Opaqueness and "accessor functions" are not good in themselves. The reason we have them for things like pte_t etc. is that there really is absolutely zero portably accessible information there.