|
|
| Author |
Message |
ndudman
Joined: 25 Dec 2008
Posts: 79
|
|
Posted: 12 January 2009, 22:44 PM Post subject: Problem with Attribute(Used) |
|
|
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.
| Code: | 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: | 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);
}
}
} |
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 |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 13 January 2009, 6:07 AM Post subject: Re: Problem with Attribute(Used) |
|
|
| 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. |
|
| Back to top |
|
 |
ndudman
Joined: 25 Dec 2008
Posts: 79
|
|
Posted: 13 January 2009, 7:58 AM Post subject: |
|
|
Thanks for the confirmation
Regards
Neil |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 13 January 2009, 21:52 PM Post subject: Re: Problem with Attribute(Used) |
|
|
| 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).
http://www.zbasic.net/download/ZBasic/2.6/ZBasic_2-6-12.zip |
|
| Back to top |
|
 |
|