r/learnprogramming • • Apr 05 '22

Name one programming/comp sci concept you never understood and if you understand it, try to explain it to them

Name a programming concept such as virtual functions, pointers, certain algorithms, etc that you always had a hard time understanding and why.

Someone else who reads yours and does understand it, try to explain it to them to help them learn

1.6k Upvotes

738 comments sorted by

View all comments

Show parent comments

2

u/__Fred Apr 06 '22

As there is no answer here, yet:

You mean, the linker as a part of creating an executable program?

AFAIK there are multiple steps if you compile a C program with multiple source files. You parse it, you translate it to assembler or directly into binary machine code. Then you have multiple "object"-files for each source file and then the linker combines them together.

I imagine he just concatenates them to each other and then he would also have to adjust the addressses of references to any memory location. Maybe there is a complicated algorithm here that you don't understand.

1

u/paulstelian97 Apr 09 '22

There is a bit of complexity in there, on how symbols and relocations are handled. I intended to answer this, but because I couldn't use a proper Reddit bot I never considered opening Reddit on my laptop so I could write a proper answer.

Right now I'm answering on the phone again...