? Subscripts can crash SB (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Subscripts can crash SB

  • #1 ✎ 155 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies ?"A"[0][0][0][0] ... [0][0]' <- 1638th Referencing the 1638th subscript of a string literal causes SB to crash. Any more only causes an Out of Memory error, any less produces no error. Subscripts on string variables and string arrays cannot cause SB to crash. Posted
  • #2 ✎ 1550 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website It crashes SB while the code is being parsed (try running it with STOP or END before) I'm guessing that it's trying to pre-evaluate the expression (which I thought SB didn't to for strings... maybe it's only with [] or something) Interestingly, using 1638 [0]s with a variable will cause an out of memory error, while anything less works fine. type |less 1638 more "A" |works crash error A$ |works error error "A"*1|works error error so yeah, looks like only "string"[index] is precomputed, which is kind of strange, but makes sense because it would reduce the size of the code, unlike something like "string"*2 which would use MORE code memory. EDIT: I did some testing, and it doesn't look like "A"[0] is precomputed, because it's slower than "A" by itself. Posted Edited by 12Me21