15

From the essay Programming Languages Explained by Paul Graham, published in Hackers & Painters:

The high-level language that you feed the compiler is also known as source code, and the machine language translation it generates is called object code.

From the Wikipedia article on object code:

Object code, or sometimes object module, is what a computer compiler produces.

From a definition of 'compiler':

Traditionally, the output of the compilation has been called object code or sometimes an object module. (Note that the term "object" here is not related to object-oriented programming.)

So what is the term object related to?

3
  • 2
    Note that a compiler does not have to generate machine code. It is customary to have a lower abstraction level , otherwise it is normally called a translator.
    – user1249
    May 18, 2012 at 15:10
  • 2
    The first two people that had to communicate with each other about object code didn't know what to call it so they adopted a very generic term.
    – semaj
    May 18, 2012 at 15:43
  • The good people over in RetroComputing.SE might have better insight into this.
    – Roger
    Oct 31, 2019 at 14:54

5 Answers 5

12

Object code is sometimes also called target code, because it is the target result of the translation process performed by compilers. So "object code" is used as an opposite of "source code".

There are other strange names in the compiler world: for example, the segment of the file with the binary code of your program is often called "the text segment".

2
  • 1
    Any idea why it's called "text"? As in the historical origin?
    – nielsbot
    Mar 16, 2018 at 5:16
  • @nielsbot: I think it's simply that in contrast to the "data segment" where variables are stored, the "text segment" contains what was originally (before compilation) text, namely the program's code. Oct 31, 2019 at 9:19
8

It is object as in "objective". Not object as a "thing".

Similar to dasblinkenlight's answer about being called "target code". It is the target or objective of the compiler.

3
  • 1
    Not sure I agree with that. May 18, 2012 at 17:39
  • 1
    Sounds about right to me. It's always been referred to in the context of the objective of the compiler.
    – Lord Tydus
    May 19, 2012 at 0:41
  • Yes, this is the right answer. It reflects how it works in a sentence, where the verb represents the compiler (the doer), the subject is the source code, and the object is the target or result of that action (compilation). Hence "subject code" is the source (that undergoes compilation, as its "subject"), while "object code" is the target (the "objective" of the compilation). Jul 1, 2018 at 0:33
1

Object code is produced when you compile a source code. This object code is not executable yet because it does not have required libraries to run. So you link multiple object codes and libraries and it becomes an executable.

In my understanding "object" relates to the "thing" you developed by writing that source code. It can be a module, class, function or anything.

-1

Object Code belongs to Object File.

The term Object in early Computer Science does not refer to "objective" (a.k.a "target"), but instead stresses a property of objects to be easily recognizable, distinct from one another. Ordinary objects are easy to define and talk about, because they have boundaries. Unlike fog...

Virtual objects are containers of data.

It's not that you sit down and write some code and it's somehow Object Code. No, you sit down read requirements of ELF, COFF, XCOFF (common Object File formats) and if your code fits these requirement it becomes an Object Code as you say.

-3

Normally students understands low level language or a program written in low level language is called "object code" . There is make an issue to understand why the output of the compiler is called object code. Genernally output is called target which is compile by the compiler. It is objective of the source code. There is not meaning that the object code is low level language program. Just it is generate the target so target is relate to objective and objective of the source code that is compile by the compiler and that's why the output of the compiler is normally called " object code". Because low language is not compile by compiler. Low level language have there on translator like " Assembler" or "interpreter".

Not the answer you're looking for? Browse other questions tagged or ask your own question.