j***@usm.edu
2018-06-03 01:08:13 UTC
Hello all
For many problems it is not always known in advance how many copies of an object will be. For instance, suppose I want to write a program that will manipulate matrices, but I don't know in advance the size of the matrix, because I don't know whether the end user needs a 2x2 matrix or a 10000x100 matrix.
One can, of course, decide in advance that the system will handle a "maximum" size matrix (say) and restrict the user to that (a la TeX and LaTeX***), but a more flexible approach is to allocate a block of memory whose size is not known until runtime. I've seen some discussion in comp.lang.oberon's history about the NEW(ptr, num) command that exists in Oberon-2 and in Wirth's Oberon extension for the ARM, but what I've not seen is an answer to this question:
Is the Oberon and/or Oberon-07 way to approach this scenario: the former (everything decided at compile-time)? Or is there a way to allocate blocks of memory whose sizes are unknown until runtime?
(I'm sorry if this has been asked before, but I did a search & didn't find an answer to this.)
regards
john perry
***For example, https://tex.stackexchange.com/questions/26205/increase-latex-capacity
For many problems it is not always known in advance how many copies of an object will be. For instance, suppose I want to write a program that will manipulate matrices, but I don't know in advance the size of the matrix, because I don't know whether the end user needs a 2x2 matrix or a 10000x100 matrix.
One can, of course, decide in advance that the system will handle a "maximum" size matrix (say) and restrict the user to that (a la TeX and LaTeX***), but a more flexible approach is to allocate a block of memory whose size is not known until runtime. I've seen some discussion in comp.lang.oberon's history about the NEW(ptr, num) command that exists in Oberon-2 and in Wirth's Oberon extension for the ARM, but what I've not seen is an answer to this question:
Is the Oberon and/or Oberon-07 way to approach this scenario: the former (everything decided at compile-time)? Or is there a way to allocate blocks of memory whose sizes are unknown until runtime?
(I'm sorry if this has been asked before, but I did a search & didn't find an answer to this.)
regards
john perry
***For example, https://tex.stackexchange.com/questions/26205/increase-latex-capacity