The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
64 char print - 32 lines version
#18
nitrofurano Wrote:btw, i checked my code by testing it in part, and the compiler bug seems to be related with a variable name i used - i replaced 'character$' with 'name$', and that error message dissapeared.


Code:
... sub print64x32at(x2 as ubyte,y2 as ubyte,characters$ as string) for i3=0 to len(characters$)-1 e3=code(character$(i3)) ' <<== BUG wrong (undeclared) variable putchar64x32( (x2+i3) mod 64 ,y2 + int((x2+i3)/64), e3) next i3 end sub ...
First of all, the above code has a bug: the parameter variable is characters$ whilst the inner variable is character$ (there is a missing -s at the end). They're different variables. The compiler crashed because it was not correctly managing this bug: when you use an undeclared alfanumeric VARIABLE$(Expression) it can mean be one of these 3 things:
  • VARIABLE$ is an array of Strings, and you want to get the i-th one (<expression>). This is discarded as undeclared arrays are not allowed (precisely to avoid this ambiguity)
  • VARIABLE$ is a function returning a string, and you want to get the result (<expression> is the parameter). This is also discarded, since ZX Basic requires you to use DECLARE to prototype functions in advance.
  • VARIABLE$ is a String, and you want the i-th character (string slicing). THIS is the meaning the compiler will get now since the other two are discarded.
Hope I've made things clear! :roll:
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)