计算机专业外文翻译c++的起源一个小的历史

上传人:ra****d 文档编号:194939891 上传时间:2023-03-14 格式:DOC 页数:7 大小:49.50KB
收藏 版权申诉 举报 下载
计算机专业外文翻译c++的起源一个小的历史_第1页
第1页 / 共7页
计算机专业外文翻译c++的起源一个小的历史_第2页
第2页 / 共7页
计算机专业外文翻译c++的起源一个小的历史_第3页
第3页 / 共7页
资源描述:

《计算机专业外文翻译c++的起源一个小的历史》由会员分享,可在线阅读,更多相关《计算机专业外文翻译c++的起源一个小的历史(7页珍藏版)》请在装配图网上搜索。

1、外文原文The Origins of C+: A Little HistoryComputer technology has evolved at an amazing rate over the past few decades. Today a notebook computer can compute faster and store more information than the mainframe computers of the 1960s. Computer languages have evolved, too. The changes may not be as dram

2、atic, but they are important. Bigger, more powerful computers spawn bigger, more complex programs, which, in turn, raise new problems in program management and maintenance. In the 1970s, languages such as C and Pascal helped usher in an era of structured programming,a philosophy that brought some or

3、der and discipline to a field badly in need of these qualities. Besides providing the tools for structured programming, C also produced compact,fast-running programs, along with the ability to address hardware matters, such as managing communication ports and disk drives. These gifts helped make C t

4、he dominant programming language in the 1980s. Meanwhile, the 1980s witnessed the growth of a new programming paradigm: object-oriented programming, or OOP, as embodied in languages such as SmallTalk and C+. Lets examine these C and OOP a bit more closely.The Mechanics of Creating a ProgramSuppose y

5、ouve written a C+ program. How do you get it running? The exact steps depend on your computer environment and the particular C+ compiler you use, but they should resemble the following steps:1. Use a text editor of some sort to write the program and save it in a file. This file constitutes the sourc

6、e code for your program.2. Compile the source code. This means running a program that translates the source code to the internal language, called machine language, used by the host computer. The file containing the translated program is the object code for your program.3. Link the object code with a

7、dditional code. For example, C+ programs normally use libraries. A C+ library contains object code for a collection of computer routines, called functions, to perform tasks such as displaying information onscreen or calculating the square root of a number. Linking combines your object code with obje

8、ct code for the functions you use and with some standard startup code to produce a runtime version of your program. The file containing this final product is called the executable code. CAsyncSocketA CAsyncSocket object represents a Windows Socket an endpoint of network communication. Class CAsyncSo

9、cket encapsulates the Windows Sockets API, providing an object-oriented abstraction for programmers who want to use Windows Sockets in conjunction with MFC.This class is based on the assumption that you understand network communications. You are responsible for handling blocking, byte-order differen

10、ces, and conversions between Unicode and multibyte character set (MBCS) strings. If you want a more convenient interface that manages these issues for you, see class CSocket.To use a CAsyncSocket object, call its constructor, then call the Create function to create the underlying socket handle (type

11、 SOCKET), except on accepted sockets. For a server socket call the Listen member function, and for a client socket call the Connect member function. The server socket should call the Accept function upon receiving a connection request. Use the remaining CAsyncSocket functions to carry out communicat

12、ions between sockets. Upon completion, destroy the CAsyncSocket object if it was created on the heap; the destructor automatically calls the Close function. CsocketClass CSocket derives from CAsyncSocket and inherits its encapsulation of the Windows Sockets API. A CSocket object represents a higher

13、level of abstraction of the Windows Sockets API than that of a CAsyncSocket object. CSocket works with classes CSocketFile and CArchive to manage the sending and receiving of data.A CSocket object also provides blocking, which is essential to the synchronous operation of CArchive. Blocking functions

14、, such as Receive, Send, ReceiveFrom, SendTo, and Accept (all inherited from CAsyncSocket), do not return a WSAEWOULDBLOCK error in CSocket. Instead, these functions wait until the operation completes. Additionally, the original call will terminate with the error WSAEINTR if CancelBlockingCall is ca

15、lled while one of these functions is blocking.To use a CSocket object, call the constructor, then call Create to create the underlying SOCKET handle (type SOCKET). The default parameters of Create create a stream socket, but if you are not using the socket with a CArchive object, you can specify a p

16、arameter to create a datagram socket instead, or bind to a specific port to create a server socket. Connect to a client socket using Connect on the client side and Accept on the server side. Then create a CSocketFile object and associate it to the CSocket object in the CSocketFile constructor. Next,

17、 create a CArchive object for sending and one for receiving data (as needed), then associate them with the CSocketFile object in the CArchive constructor. When communications are complete, destroy the CArchive, CSocketFile, and CSocket objects. CSocketFileA CSocketFile object is a CFile object used

18、for sending and receiving data across a network via Windows Sockets. You can attach the CSocketFile object to a CSocket object for this purpose. You also can and usually do attach the CSocketFile object to a CArchive object to simplify sending and receiving data using MFC serialization.To serialize

19、(send) data, you insert it into the archive, which calls CSocketFile member functions to write data to the CSocket object. To deserialize (receive) data, you extract from the archive. This causes the archive to call CSocketFile member functions to read data from the CSocket object.Tip Besides using

20、CSocketFile as described here, you can use it as a stand-alone file object, just as you can with CFile, its base class. You can also use CSocketFile with any archive-based MFC serialization functions. Because CSocketFile does not support all of CFiles functionality, some default MFC serialize functi

21、ons are not compatible with CSocketFile. This is particularly true of the CEditView class. You should not try to serialize CEditView data through a CArchive object attached to a CSocketFile object using CEditView:SerializeRaw; use CEditView:Serialize instead. The SerializeRaw function expects the fi

22、le object to have functions, such as Seek, that CSocketFile does not have.Using the MFC Source FilesThe Microsoft Foundation Class Library (MFC) supplies full source code. Header files (.H) are in the MFCInclude directory; implementation files (.Cpp) are in the MFCSrc directory. NoteThe MFCSrc direc

23、tory contains a makefile you can use with NMake to build MFC library versions, including a browse version. A browse version of MFC is useful for tracing through the calling structure of MFC itself. The file Readme.Txt in that directory explains how to use this makefile.This family of articles explai

24、ns the conventions that MFC uses to comment the various parts of each class, what these comments mean, and what you should expect to find in each section. ClassWizard and AppWizard use similar conventions for the classes they create for you, and you will probably find these conventions useful for yo

25、ur own code.You might be familiar with the public, protected, and private C+ keywords. When looking at the MFC header files, youll find that each class may have several of each of these. For example, public member variables and functions might be under more than one public keyword. This is because M

26、FC separates member variables and functions based on their use, not by the type of access allowed. MFC uses private sparingly even items considered implementation details are generally protected and many times are public. Although access to the implementation details is discouraged, MFC leaves the d

27、ecision to you.中文译文c+的起源:一个小的历史过去的几十年计算机技术以惊人的速度得到发展。今天,一个笔记本电脑和20世纪60年代的电脑主机相比,计算的速度更快并且存储更多的信息更多。计算机语言也进化了。可能这些变化不富有戏剧性,但它们是重要的。更大,更强大的计算机产生更大、更复杂的程序,这又反过来,提出在项目管理与维护方面的新的问题在20世纪70年代,像C和帕斯卡等语言帮助传达员进入结构化程序设计阶段。一种哲学带来了一个领域的一些新的指令和规则来满足这些功能。随着定位硬件能力的增强,比如管理硬盘驱动等功能,C+除了提供结构化程序的工具之外,也产生了集成的快速运营的程序。这些功能

28、得C成为20世纪80年代占主导地位的编程语言。与此同时, C语言见证了20世纪80年代的新编程范式:面向对象编程,或者是OOP,体现在语言上例如SmallTalk和c+。让我们验证一下C和OOP的联系更密切。创建一个程序的技术假设你已经写完了一个c+程序。你如何让它运行?确切的步骤取决于你的计算机应用环境和你使用的特定的c+编译器,但他们应该遵循以下步骤进行:1。使用一个文本编辑器来编写某一种类的程序并保存在一个文件中。这个文件构成你的程序的源码。2。编译源代码。这意味着运行一个把源代码翻译成内部语言也叫做机器语言的程序,从而被主机应用。翻译出来的程序文件包括的编译文件也就是你的程序的目标代码

29、 3,把额外的代码与目标代码连接起来。例如,通常使用的c+程序库。一个c+库,包括你的电脑日常运行所需要的目标代码,被称为函数,完成显示屏幕信息或计算一个数值的平方根的任务。把你的目标代码与你使用的目标函数的目标代码和使用一些标准的启动程序的代码结合起来以产生你的程序的运行版本。该文件包含这最后的结果就是所谓的可执行代码。CAsyncSocket一个CAsyncSocket对象代表了一个窗口,一个网络通信的节点。CAsyncSocket类包含Windows Sockets API,为想把Windows Sockets与MFC 结合起来使用的程序员提供了一个面向对象的抽象的工具。这个类是建立在假

30、定你理解网络通信的基础上。你是负责处理相互之间的差异,字节顺序的不同、转换不统一的字符和处理多字节之间的差异并且设置MBCS线。如果你想要一个比较方便的接口来管理你关注的问题,这就需要用到Csocket类。使用一个CAsyncSocket对象,调用它的构造函数,然后用构造函数的功能构造需要的字节套接字,除了已经接受的套接字。对于一个服务器套接字调用监听的子函数,并为接口套接字调用联接函数。服务器套接字的功能是一接收到联接请求就接受请求。使用剩余CasyncSocket函数能够进行套接字之间的交流。工程竣工后,如果是创建对象的析构函数自动的废堆,调用关闭函数。Csocket类CSocket源于C

31、AsyncSocket和套接字窗口的API。一个CSocket对象代表了比CAsyncSocket object更高的更抽象的窗口套接字API。CSocketFile CSocket类和CsocketFile 类 以及Carchive一起工作是为了管理发送和接收的数据。一个CSocket对象也提供阻断,这是与CArchive同步运行的非常关键点。阻断的功能,比如接收、发送,接收自,发送到,接受(都是从CAsyncSocket继承来的),在csoket中不要返回一个WSAEWOULDBLOCK 误差。而且,这些函数将会等到所有的操作都结束。此外, 如果取消阻塞调用被认为是阻塞函数调用的一种,那么

32、原来的调用将会与WSAEINTR的误差一起终止。为了使用一个CSocket对象,又叫构造函数,然后调用是为了创建套接字字节。按后默认的参数的创建一个套接字数据库,但如果你没有利用Carchiv对象,,你可以指定一个参数创建一个数据包。或捆绑到一个特定的端口创建一个套接字服务器端口。使用一个连接套筒连接到一个客户端并且在在客户端和服务器端接受。然后创建一个CSocketFile对象,然后把它和CsocketFile构造函数中的Csocket对象结合起来。其次,创建一个Carchive对象来发送和接收数据(如有必要),然后把这些和Carchive构造的函数中的Csocket对象结合起来。当通讯结束

33、,破坏CSocketFile,CArchive CSocket对象。CSocketFile一个CSocketFile对象是用于当时对象的数据发送和接收通过窗户通过网络接口。为了这个目的你可以把CsocketFile对象接近Csocket对象。你也可以,通常所做的那样将CsocketFile接近一个CArchive对象简化发送和接收数据通过采用MFC系列化。为了发送数据,你把它存档案,并调用CsocketFile子函数并输入数据到CSocket对象。为了接收数据,你提取存档。这使得存下的文档调用CsocketFile子函数并从CSocket对象中读取数据。除了利用CSocketFile,就像这里

34、描述的,你可以用它作为一个独立的文件对象,正如你能用其归档其基类。你也可以使用CsocketFile中任何archive-based MFC串行化功能。因为CSocketFile不支持所有的功能,一些默认的MFC同步功能是不兼容CsocketFile的。这是特别符合CeditView类。你不应该试图通过利用CeditView来将一个Carchive对象趋近CSocketFile数据对象来使CEditView 数据系列化。使用CEditView:同步代替。SerializeRaw函数希望文件对象有选择功能,例如,CSocketFile寻求并不存在。使用MFC的源文件微软的基础类库(MFC)提供充

35、分的源代码。头文件(h)在MFC 包括目录文件(不必;实施)在MFC Src目录。值得注意的是MFC Src目录包含一个基本程序结构以及实用编译方法你可以与Nmake联系起来用来建立MFC库的版本,包括浏览版本。一个浏览版本的MFC通过调用MFC本身是有用的跟踪结构。Readme文件。Txt文件在指定的目录将解释如何使用这个文件。这些文章阐述了使用MFC进行不同类不同部分的评论,这些评论的意思,和在每一个部分你应该期盼发现什么。ClassWizard和AppWizard对于你所创造的类使用相似的惯例, ,你会发现这些规定对于你的代码是有用的。你可能熟悉公共的受保护的和私人的c+关键字。看着那MFC的头文件,你就会发现,每一个类可以有这些类中的几个。例如,公众成员变量和函数底下会有多于一个的公共的关键字。这是因为MFC分离变量和函数成员根据他们的使用,而不是允许的访问类型。MFC使用私人方式甚至考虑到完全的细节的项目不但被公开多次而且也被保护起来。尽管完善细节的入口没了,但是MFC仍然留给你决定权。

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!