Does a fixed string prevent accidental writing beyond allocation boundaries?
Posted: Mon Dec 18, 2023 9:59 pm
If I allocate a fixed string, do I also need to perform bounds checking to ensure that assignments to that string do not exceed beyond its boundaries? I'm hesitant to say "yes", but I would like a official response. Are there any edge cases which I should be aware of?
See this example where I write beyond the end of a string but cannot read back those characters (I see garbage instead).
See this example where I write beyond the end of a string but cannot read back those characters (I see garbage instead).
Code: Select all
Structure String5
s.s{5}
EndStructure
a.String5
a\s="abcdefghij"
Debug PeekS(@a\s+5,5) ;/ Initial garbage visible
Debug a\s
Debug PeekS(@a\s+5,5) ;/ The same garbage is visible (no string characters)