Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Gammastrahler

Designing a Runtime Environment for my own Scripting Language

This topic is 5673 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I have a question concerning the development of my own scripting language. The language is C style, and should support the basic data types. The compiler and runtime env works already for integers and floats, but not for strings, since i have no idea how to organize the memory for strings so i can access it. I can access it by memory address, but i cannot figure out the length of the string since the next byte in memory could also point to another variable. Can someone help me on this topic? thanks Gammastrahler

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Instead of having the next byte of memory possibly being something else, why not define that it''s always the length of the string.

Or you could NULL terminate the strings - meaning that you come to the end of the string when you read a byte which is 0.

Or if neither these work, then have the string variable point to an area of memory (dynamically allocated I''d have though), in which the first value is the length of the string..

You should go for option 3 really (depending if your strings are immutable or not (ie can they change))

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!