14

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?

  • 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 '12 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 '12 at 15:43
10

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".

  • Any idea why it's called "text"? As in the historical origin? – nielsbot Mar 16 '18 at 5:16
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.

  • 1
    Not sure I agree with that. – Martin York May 18 '12 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 '12 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). – BarbaraKwarc Jul 1 '18 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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