什么是"专用头"用C?

编程入门 行业动态 更新时间:2024-10-27 11:24:13
本文介绍了什么是"专用头"用C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在学习 C 近日,在我的教科书之一,我发现了.R扩展名的参考文件。现在,你可以想像,谷歌搜索R或文件扩展名R是不是生产性的,所以我不知道你能不能帮我。

I've been learning C recently, and in one of my textbooks I found a reference to a file with the ".r" extension. Now, as you can imagine, googling "r" or "file extension r" is not productive, so I wonder if you could help me out.

它出现在以下code座

It appears in the following code block

#include "new.r" static const struct Class _String = { sizeof(struct String), String_ctor, String_dtor, String_clone, String_differ }; const void * String = & _String;

笔者提到,它是一个私有头,但我希望他能一直为究竟是什么更清晰。

The author mentions that it is a "private header", but I wish he could have been more clear as to what exactly that is.

推荐答案

在我遇到一个 .R 文件中的实例在的面向对象与ANSI-C ,编程凡 .R 文件用作类的重presentation - (如果我理解正确)的方式通过保持内部重新presentation执行信息隐藏和控制访问一类的功能在一个单独的头文件。

The instance in which I've encountered a .r file is in Object-oriented Programming with ANSI-C, where a .r file is used as a "representation" of a class -- (if I understand correctly) a way to perform information hiding by keeping the internal representation and to control access to functions of a class in a separate header file.

只有类的实现将参照 .R 文件,并在这方面,它可以被看作是一个私有头的类。外部接口的类,普通的 .H 使用头文件。

Only the implementation of the class would refer to the .r file, and in that respect it could be regarded as a "private header" to the class. The interface externally to the class, a regular .h header file was used.

作为一个例子,一类可以由三个文件:

As an illustration, a class may be composed of three files:

Circle.h /* Header file with external interfaces, such as methods. */ Circle.r /* Representation file for internal use within the class, such as structs that define the internal states. */ Circle.c /* Implementation of the Circle class. */

然后,按照惯例,利用圆形类可能包括程序的 Circle.h 文件作为接口访问类。 Circle.r 严格使用的圆形类的实现,而不是由其他人,因此,使其成为私有头。

Then, by convention, a program utilizing the Circle class may include the Circle.h file as the interface to access the class. Circle.r is strictly used by the implementation of the Circle class and not by others, hence, making it a "private header".

的研究文件扩展名是基本上是使用习惯,而不是东西是官方或使用的所有的时间。它是用于方便和普通的头文件来区分与 ^ h 文件扩展名。

The r file extension is basically a convention that is used, and is not something that is "official" or used all the time. It is used for convenience and to differentiate from regular header files with a h file extension.

更多推荐

什么是"专用头"用C?

本文发布于:2023-05-25 10:58:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/226667.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:QUOT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!