pushing a string constant

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

pushing a string constant

virote328
When we try to translate x = 2  into a vm command it becomes
push constant 2
pop local x

but what about string constants?  str = "hello world"
My best guess is that one of the OS libraries dynamically creates a string object and then set str to point to that string object.


//numbers and chars treated the same
push constant 'h'
push constant 'e'
...
push constant '\0'
call String.Maker <num_char>
pop local str


it would really help me if someone could clarify and maybe where in the book I can find it.  If you say chapter 12 then that is why I didn't know...cause I'm on chapter 11.
Reply | Threaded
Open this post in threaded view
|

Re: pushing a string constant

cadet1620
Administrator
At the end of 11.2.1 in Use of Operating System Services.

"String constants are created using the OS constructor String.new(length)...."

--Mark