Problem with Attribute(Used)
Posted: 12 January 2009, 14:44 PM
Hi
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.
p.s 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 ?
Thanks
Neil
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.
Code: Select all
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
Code: Select all
void
zf_showDataLCD(void)
{
{
int16_t zv_a USED;
int16_t zv_b USED;
while (1)
{
zv_a = TYPECAST(int16_t, (uint8_t)zv_menuActive);
zv_b = 2;
if ()
{
taskDelay(2.1);
}
taskDelay(1.0);
}
}
}
Thanks
Neil