you are viewing a single comment's thread
view the rest of the comments
[–] 1 point 1 day ago (1 child)

Right, a stack that was itself read-only would be hard to use! :^D C definitely lets you modify the things in the stack. (Ah the fun of bugs where you accidentally overwrite other shit on the stack!) I don't know Rust, but it would not surprise me if Rust only had immutable things on the stack.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 1 day ago

    No, its not only immutable things on the stack. I mean if you include a literal constant string such as "MIT LICENSE", that is part of the compiled binary file. So it is unchangeable. Because you cannot change a literal, a "1" is always a "1" in the compiled binary file. And those are basically read only by their nature and loaded into the stack. I think or guess in C it is the same. Or any language for that matter.

    I started to think I was hallucinating. I guess what I was thinking is this part https://en.wikipedia.org/wiki/Data_segment . There are read-only data segments too.

  • source
  • parent