简体   繁体   English

在文件外部是否可以看到由'typedef'定义的类型?

[英]Is type that defined by 'typedef' visible outside the file?

http://en.literateprograms.org/Red-black_tree_(C) I got this link and found this definition. http://en.literateprograms.org/Red-black_tree_(C)我得到了这个链接并找到了这个定义。 typedef rbtree_node node; typedef enum rbtree_node_color color; It is said to be private definition. 据说是私人定义。

I am confused about private property,does it mean the node and color only visible in the file and won't propagate to other files,or just for convenience? 我对私有财产感到困惑,这是否意味着nodecolor仅在文件中可见,而不会传播到其他文件,或者只是为了方便?

It would be "private" if the typedef would be placed inside a body file. 如果将typedef放在正文文件中,则它将是“专用”。 And "public" when it would be placed inside a header file. 并且在将“ public”放置到头文件中时。 Private and public don't really exist in C, what they are probably talking about is scope. 在C语言中,私有和公共不是真正存在的,他们可能在谈论范围。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM