[futurebasic] Re: [FB] mistake in c code?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Tue, 22 Jan 2008 20:32:40 +1300
Joe Lertola wrote:

> I have this line in my project:
> tempDist# = 1.0 / Xsingle(Xindex(i))
>
> When I run it through FBtoC I get this error:
> error: unterminated comment
>
> This is the c code that was generated. It seems like divide symbol  
> and the
> asterisk are mistakenly coming together to form a comment:
>  tempDist = 1.0/*(float*)FBDynamicArray( Xsingle,  
> *(long*)FBDynamicArray( Xindex, i));

Yep, it's a bug. It occurs when the divisor is a dynamic array item or  
a dereferenced pointer.
Thanks for the report.
A workaround is to insert redundant parentheses around the divisor:
'----------------
dynamic a(1) as short
print  1.0 / (a(0))
dim p as ^pointer
p = @p
print 1 / (p.0&)
'----------------

Robert P.