5 ms·
My explanation went something like this (M is me, H is him, and yes, he was male) and this was many years ago: M: you know the COBOL MOVE statement? H:Yup. M
by zabzonk 3y ago
My explanation went something like this (M is me, H is him, and yes, he was male) and this was many years ago:
M: you know the COBOL MOVE statement?
H:Yup.
M: So when I say 'MOVE "hello world" INTO greet' what is happening?
H: The sequence of characters gets moved into the variable greet.
M: Nearly right. The characters get copied - MOVE should really be called COPY. And where do you think those characters get copied from?
H: I don't know.
M: Well, they are copied from one area of memory to another. When your compiled program is run, things like "hello world" are loaded along with the actual executable code, and given an address in memory.
[at this point i drew a diagram, but cannot be arsed doing so now]
H: OK so far
M: So when we do the COPY of "hello world" we need to have some memory to copy it into. Now, in COBOL the compiler takes care of generating code to do this, but (for a variety of reasons) the C compiler does not. So we have to do it ourselves using functions like malloc. Anyway, don't worry - you've been doing well on the course so far, and we can go through this again tomorrow, if you would like.
- marktangotango 3y agoThis one of the main things about cobol people don't understand; all memory is statically allocated, there is no dynamic memory allocation. Well there can be, but not generally. No call stack, no heap. In reality, cobol, the 85 standard and before was really very primitive. The new standards have changed this obviously, but no one uses those. The terminology this person would have understood is "working storage".