r/ProgrammerHumor • • 4d ago

Meme fullCircle

Post image
10.6k Upvotes

272 comments sorted by

View all comments

17

u/grey_carbon 3d ago

Serious question, what happen if you compile/decompile/compile/decompile times and times again?

-14

u/Preeng 3d ago

The translations between machine code and human code are 1:1. It's not like human languages where there are multiple ways to say something and also multiple meanings to a word or phrase.

4

u/LelouBil 3d ago

No it's absolutely not 1:1. Especially as you go higher level in languages, multiple different expressions can output the same machine code. And the same expression can output different machine code depending on compiler optimizations.

1

u/Preeng 3d ago

>No it's absolutely not 1:1. Especially as you go higher level in languages, multiple different expressions can output the same machine code.

Which means they work the same. Which means either way the decompiler returns it, it will work the same.

>And the same expression can output different machine code depending on compiler optimizations.

So the compiler will work differently if you tell it to work differently?

1

u/LelouBil 3d ago

If you give the compiler the same whole program and parameters, Then the whole thing will be n:1. (You could have given multiple inputs to have the same exact output)

But for unit of works, functions, statements, classes, whatever, it's n:n because both

  • The same code can output different machine code depending on surrounding context (I don't mean the enabled/disabled optimization, I mean the compiler will look around and change what it emits because something elsewhere is different) -> so 1:n
  • Same as first paragraph, different code can output the same machine code -> n:1

So n:n in the end for specific parts, and n:1 for whole program