Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
With the code below... I can't get to compile because of the way the if () block is created in c file... I think I saw this refered to when I first was looking through posts but can't find it again. The generated c code is shown below also.
public menuActive as byte
public sub showDataLCD() Attribute(Used)
do
Dim a as Integer Attribute(used)
Dim b as Integer Attribute(used)
a = CInt(menuActive )
b = 2
if ( a < b ) then
delay(2.1)
end if
delay(1.0)
loop
end sub
sub main()
menuActive = 1
end sub
est10.c:50: warning: 'used' attribute ignored
test10.c:51: warning: 'used' attribute ignored
test10.c:57: error: expected expression before ')' token
test10.bas:10: Internal Error: no means to generate code for expression
ndudman wrote:I can't get to compile because of the way the if () block is created in c file.
The problem has been verified and a solution has been identified. We still have some testing to do.
ndudman wrote:Is it really required if a sub is marked with attribute(used) to have to also mark variables (in this example a, b) also as used ?
No. Procedures that are marked with the Used attribute but not referenced in ZBasic code are currently not being processed correctly. What you're seeing is an artifact of that problem.
dkinzer wrote:The problem has been verified and a solution has been identified.
There is an experimental version of the compiler that corrects this problem (available via the link below). It is not yet fully tested but the preliminary testing results look good. The experimental version also contains the correction for the structure member reference issue (also not fully tested).