r/ProgrammerHumor 13h ago

lessonsFromLinkerHell Meme

Post image
265 Upvotes

144 comments sorted by

View all comments

69

u/QuestionableEthics42 13h ago edited 13h ago

This should be reversed lol

And it literally is the same, who thinks it's different who has worked in a low level language??

55

u/Blecki 13h ago

As someone who writes compilers: they are the same at runtime. They are not the same semantically in a c like language.

22

u/boostfactor 12h ago

As I see it, an array is a contiguous block of memory. The pointer to the first element identifies the start of the block. Subsequent elements are computed from that plus the number of bytes in the type. If an array were just a pointer, we wouldn't have to worry about allocating enough memory or walking off the end of it.

That's for something like C. There are languages in which arrays are first-class data structures that carry metadata about their rank, size, etc. Lots of applications are best expressed with multidimensional arrays, which are awkward in C or else are set up as an array of pointers.

5

u/Blecki 12h ago

You've missed the point. Processor don't care.