Thread: machine-generated code

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    127

    machine-generated code

    What is machine-generated code?

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Code generated by a computer instead of a human, of course. What else would it be?

    Also, this question has very little to do with C++ and would be better suited in the Tech or General Discussion forum. I'm moving this thread there, but please create new threads in the appropriate forum.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    127
    Yeah I ges your right

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Once we approach and reach the technological singularity computers no longer require human intelligence to write and compile their programs, they can do it themselves, thus machine generated code. If humanity will survive (seen as a species to protect) or perish (seen as a threat) is too soon to tell...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Fortuantly we'll all be dead so we don't have to worry about that

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I'm all for it. I'd rather have a machine tell me what to do, than a human. Al of a sudden I see two advantages:

    - Machines have logic circuits. I mean... when was the last time you saw that on a human leader? Precisely.

    - There's this things about machines that when they tell you something is THIS way, it is THIS way and there's no manner of complaining that will make it THAT way. They just know what they want.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #7
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Machine generated code should free up time to do more "human" things such as fishing, music, and so forth. I'll look forward to it if the ecosystem has survived that long. I'm not sure if I'll ve around to see it or not. I wouldn't mind it, particularly since I'm so slow and methodical: most people probably did a lot with their lives by my age, but not me. I need the longevity.

  8. #8
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    My hello.exe is machine-generated code.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  9. #9
    Registered User
    Join Date
    Jun 2008
    Posts
    2
    Machine generated code, can refer to when a compiler takes high level code C and you run it through the compiler to generate assembley. So that the machine can understand this code , hence machine code



    ------------------------------------------------------------------
    http://www.softhardware.co.uk

  10. #10
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    That's what I was referring to.

    [Though, by the way, you don't have it quite right: a C compiler generates assembly, all right, but the computer can't run that directly. The assembly code has to be converted to machine code by an assembler, but this is a very simple process since there is almost a 1:1 correlation between assembler and machine code. Machine code itself is what the computer can actually execute.]

    [edit] A more credible example is something like bison, a parser generator: given a grammar definition, bison (or its older cousin, yacc) generates a C program to parse input based on the rules outlined in the grammar. [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  11. #11
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by Thantos View Post
    Fortuantly we'll all be dead so we don't have to worry about that
    Then drop dead quick because we already use machine generated code.

    Some seperation needs to be made here between machine generated code, and machine generated applications. I have written short programs whose only purpose was to generate a large tedious sequence of code. The reasons for needing the expanded code rather than using a loop are usually particular to the problem, but the technique comes in handy occasionaly, although not that often. In 30 years of programming I've only needed to use it about 3 times.

  12. #12
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    This is not exactly rare. The mysql++ library used a perl script to generate code. Tedious repetitive macros with an increasing number of arguments.


    However, machine-generated code most often refers to code that is generated from a very different-looking representation. Lex and yacc are examples, but not particularly good ones. UML-to-code translators and GUI editors are more interesting.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  13. #13
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Machine generated code happens also every time you use a compiler.

    EDIT: Not meaning to ignore your last statement CornedBee. Just addressing the term from yet another angle.
    Last edited by Mario F.; 06-23-2008 at 08:19 AM.

  14. #14
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by Mario F. View Post
    Machine generated code happens also every time you use a compiler.
    That isnt machine generated, its machine translated.

    http://en.wiktionary.org/wiki/generate

    http://en.wiktionary.org/wiki/translate

  15. #15
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    As I said. It's another angle. If you want to get into that kind of detail then the real answer to the initial question is "It doesn't exist. Why you ask?"
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  2. << !! Posting Code? Read this First !! >>
    By kermi3 in forum Linux Programming
    Replies: 0
    Last Post: 10-14-2002, 01:30 PM
  3. Machine code, asm, poop
    By tim545666 in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 04-02-2002, 01:27 AM
  4. Replies: 4
    Last Post: 01-16-2002, 12:04 AM
  5. auto <cringe> generated <cringe> code <cringe>
    By RobS in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-22-2001, 04:46 AM