[Preston] Object orientated compiler question.

Giacomo Lacava preston at mailman.lug.org.uk
Mon Nov 18 09:02:00 2002


> If the two programs do the same thing, why would=20
> the instruction sequences be different?=20

because of the compiler's work. The way the compiler handles two languages =
should be different. If the two languages share the same syntax for =
certain task, then *maybe* the compiler could produce the same machine =
code: but in this situation also the source would be exactly the same.

> Are you saying that the=20
>object-oriented compiler compiles *machine code* that also behaves in =
an=20
>object orientated way?=20

absolutely not: the machine code always works with the Von Neumann model =
"in mind"... But the compiler behaves differently depending on the program =
syntax, producing different sets of instructions. Eventually, the real low =
level language works in the same way as before the oop paradigm was =
"discovered" :)

> So could a machine code program originally written in C++, be de-compiled=
 into C?

I don't know. I mean, decompiling a thing in assembler is always possible. =
But above that... I don't know. You should look at what the specific =
compiler does.

If you're so interested, google around for compiler sources, seeing what =
they  exactly do. Gcc is the most obvious (and difficult, I think) choice, =
but there are plenty of others :)

bye
Giacomo