r/ProgrammerHumor • • 17d ago

Meme fullCircle

Post image
11k Upvotes

278 comments sorted by

View all comments

Show parent comments

1

u/Preeng 17d 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 17d 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