Thread: is object code the same as assembly source code?

  1. #1
    Registered User
    Join Date
    Apr 2010
    Location
    Vancouver
    Posts
    132

    is object code the same as assembly source code?

    Is object code the same thing as assembly source code? According to the wikipedia article object code is usually machine code, which is not the case for C, C++ or C# right?

    And assembly source code, and machine code (as close as they are) are two different things, right?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Yes, they're different.

    Source code is text.
    Object code is binary machine language.

    Get/use a good hex editor and open some programs up and take a look.
    Definately not something you'll get from notepad.

  3. #3
    Registered User gardhr's Avatar
    Join Date
    Apr 2011
    Posts
    151
    Machine code is the actual collection of bit-patterns that execute on a particular CPU. The term "object code" is sometimes used to refer to the most basic kind of output produced by compilers, but the more common expression is simply "object files". You can think of them as chunks of machine code organized in such a way that makes it possible for the linker to produce more complex file types (library files, executables, etc). Source code, whatever the language, is simply the textual representation of programming concepts. For languages like assembly, C, and C++, source code is typically converted to stuff that runs on CPU's. Other languages, like C# and Java, generally convert it to some sort of "pseudo machine code" that executes within a "virtual machine". Some interpreted languages don't even go this far and instead just execute in a virtual environment right as the source is being parsed. Ultimately, though, the implementation of any given language can take any one of these routes (or some other route, for that matter), so there really isn't one "right" answer for what sort of output to expect.

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    The object code is the stuff that's in the object file. That might be machine code or it could be something else (like VM code, IL, etc)
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Generate Assembly code and Binary code also
    By Hannibal2010 in forum C Programming
    Replies: 16
    Last Post: 07-07-2011, 05:43 AM
  2. Convert assembly>machine code, machine code>assembly
    By wenxinleong in forum C Programming
    Replies: 12
    Last Post: 06-23-2011, 10:42 PM
  3. Converting C code to DLX assembly code
    By xyz3 in forum C Programming
    Replies: 2
    Last Post: 05-17-2010, 02:01 PM
  4. GCC option to get assembly code AND C code
    By AntoineC in forum C Programming
    Replies: 2
    Last Post: 04-29-2010, 09:04 AM
  5. assembly code for release code?
    By George2 in forum Windows Programming
    Replies: 4
    Last Post: 07-09-2008, 11:17 AM