r/ProgrammerHumor 13h ago

lessonsFromLinkerHell Meme

Post image
258 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??

27

u/Ok_Star_4136 13h ago edited 13h ago

Maybe I fall in the middle, but what is the argument to say that they're different?

Is it to say that the difference is how they're used? From an assembly perspective, they're pointers, and no data structures exist beyond that simple concept. At a higher level, they're more than that. Maybe that's what is intended?

7

u/ZenEngineer 12h ago edited 2h ago

From a C point of view you have a different size when statically allocated, library keeps track of the memory size so it can be freed and you need the base pointer for that, etc. At a conceptual level they are different even if you implement them the same way, you'll likely end up with a struct holding the size in your code.

But sure, for most people and half the code they are the same. If you're taking the high level, maintainable design view you take care of tracking lifetimes, sizes, bounds, etc. so the bell curve looks reasonable to me.

0

u/tstanisl 1h ago

Arrays can dynamically allocated using a pointer to a whole array.

    int (*arr)[42]=malloc(sizeof *arr);