View Full Version : machine-generated code

06-22-2008, 08:59 AM
What is machine-generated code?

06-22-2008, 09:05 AM
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.

06-22-2008, 09:13 AM
Yeah I ges your right

06-22-2008, 02:42 PM
Once we approach and reach the technological singularity (http://en.wikipedia.org/wiki/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...

06-22-2008, 02:55 PM
Fortuantly we'll all be dead so we don't have to worry about that :)

Mario F.
06-22-2008, 03:31 PM
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.

06-22-2008, 05:48 PM
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.

06-22-2008, 09:14 PM
My hello.exe is machine-generated code. ;)

06-22-2008, 09:40 PM
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 ;)

06-22-2008, 09:56 PM
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.]

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.

06-23-2008, 07:52 AM
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.

06-23-2008, 07:58 AM
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.

Mario F.
06-23-2008, 08:15 AM
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.

06-23-2008, 09:02 AM
Machine generated code happens also every time you use a compiler.

That isnt machine generated, its machine translated.



Mario F.
06-23-2008, 09:15 AM
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?"

06-23-2008, 09:28 AM
Then drop dead quick because we already use machine generated code.
It generally helps to read posts in context. It should be pretty clear that I was responding to Magos and the idea of a technological singularity

06-23-2008, 11:05 AM
Al of a sudden I see two advantages:

I know you meant to say 'All', but it looks like 'AI'. How fitting :D

Back to the topic, yes...machines are way more 'logical' than humans. Having no emotions to cause cognitive dissonance is another plus. But will this always be the case? Human consciousness is the result of a staggeringly complex level of organization and processing. It is indeed the 'highest' level client software in the known universe. The price of such advancement, the price of the miracle of consciousness...is most ironically the seemingly 'illogical' behaviour that is often caused by emotions.