源代码和目标代码之间的区别

Here you will learn about difference between source code and object code.

在这里,您将了解源代码和目标代码之间的区别。

Source Code

源代码

Source Code, as the name suggests, it is the source of a program, the file original which is written by the programmer.

顾名思义,源代码是程序的源代码,是由程序员编写的原始文件。

The line above is sufficient if you are looking for a definition of the Source Code, adding to this, the following points will help in a better understanding of the topic.

如果您正在寻找源代码的定义,那么上面的代码行就足够了,此外,以下几点将有助于您更好地理解该主题。

Source Code refers to file which is a text based document that is written by the programmer. The programmer writes the code for performing some task in the human readable language, almost English every time, and saves the file into a prescribed format. For Example – ‘.java’ for JAVA code, ‘.cs’ for C# code, etc. This file is written following some conventions and rules of a particular programming language that can be any high level language of programmer’s choice and is saved accordingly with the correct extension. The Source Code is human readable but machines can’t understand instructions given in English, or any other human language, directly so this code is actually of no use to the machine until compiled by the compiler of the language into machine executable code.

源代码是指文件,它是程序员编写的基于文本的文档。 程序员用人类可读的语言(几乎每次都是英语)编写用于执行某些任务的代码,然后将文件保存为规定的格式。 例如,“。java”代表JAVA代码,“。cs”代表C#代码,等等。该文件是遵循特定编程语言的某些约定和规则编写的,这些惯例和规则可以是程序员选择的任何高级语言,并相应地保存为正确的扩展名。 源代码是人类可读的,但是机器无法直接理解以英语或任何其他人类语言给出的指令,因此,直到该语言的编译器将其编译成机器可执行代码后,该代码才真正对机器没有用。

Source Code is served as an input to the compiler of the language in which it is written.

源代码被用作编写语言的编译器的输入。

Difference between Source Code and Object Code

Object Code

目标码

Object Code is the machine executable file having instructions for the machine in the form of binary digits, generated by the compiler.

目标代码是机器可执行文件,其中包含由编译器生成的二进制形式的机器指令。

Definition is self explanatory but adding to this following explanation can provide a good understanding.

定义是不言自明的,但是在以下说明中加进可以提供很好的理解。

First of all, Object Code is the output of the compiler and is a binary file having instructions that were given by the programmer in the Source Code. These instructions are encoded in the binary digits and Object Code is machine readable, or better to say machine executable code, but not human readable, until and unless programmer is an expert in binary coding.

首先,目标代码是编译器的输出,并且是一个二进制文件,具有由程序员在源代码中给出的指令。 这些指令以二进制数字编码,并且除非且除非程序员是二进制编码专家,否则目标代码是机器可读的,或者说机器可执行代码,但不是人类可读的。

Object Code is generated through a process called compilation, carried out by compiler to convert Source Code into the machine executable code.

目标代码是通过称为编译的过程生成的,该过程由编译器执行以将源代码转换为机器可执行代码。

Object Code is system architecture specific, i.e., the file generated by the compiler at one machine might not work on other machines with different system architecture, or underlying structure. Though this problem is solved by the use of Intermediated Code and Just In Time Compiler but still many languages, like JAVA, follow the traditional way of object code generation.

目标代码是特定于系统体系结构的,即在一台计算机上由编译器生成的文件可能无法在具有不同系统体系结构或基础结构的其他计算机上运行。 尽管通过使用中介代码和即时编译器可以解决此问题,但是仍然有许多语言(如JAVA)遵循目标代码生成的传统方式。

Last point about Object Code is the way the changes are reflected. When the Source Code is modified, each time the Source Code needs to be compiled to reflect the changes in the Object Code.

关于目标代码的最后一点是反映更改的方式。 修改源代码后,每次需要编译源代码以反映目标代码中的更改。

This was a description about both the type of codes.

这是关于两种代码类型的描述。

The following table concludes the difference between the two.

下表总结了两者之间的区别。

源代码与目标代码–源代码与目标代码之间的区别 (Source Code vs Object Code – Difference between Source Code and Object Code)

Source CodeObject Code
Created by the programmer.Created by the Compiler.
Text rich document.Binary digits make up the Object Code.
Human Readable.Machine Readable.
Can be changed over time.Needs to compile the Source Code each time a change is to be made.
Not system specific.System specific.
Serves as input to the compiler.It is the output of the compiler.
Instructions written using English words and according to syntax of the language.Instructions encoded in Binary digits.
源代码 目标码
由程序员创建。 由编译器创建。
文本丰富的文档。 二进制数字组成目标代码。
人类可读。 机器可读。
可以随时间改变。 每次进行更改时都需要编译源代码。
不是系统特定的。 系统特定。
用作编译器的输入。 它是编译器的输出。
使用英文单词并根据语言语法编写的说明。 指令以二进制数字编码。

Comment below if you have queries regarding difference between source code and object code.

如果您对源代码和目标代码之间的差异有疑问,请在下面评论。

翻译自: https://www.thecrazyprogrammer.com/2018/05/source-code-and-object-code.html

  • 13
    点赞
  • 44
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值