[futurebasic] Re: [FB] FBtoC: compile error: "invalid operands to binary" and other

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

From: Brian Stevens <bstevens33@...>
Date: Mon, 18 Feb 2008 19:22:40 -0700
Thanks to all the folks who responded. Some more comments below:

On Feb 18, 2008, at 6:09 PM, Robert Purves wrote:
>>
>
> The function gives a flood of warnings from gcc because many of the  
> variable and parameter declarations are wrong.
> The compilation error, also due to a wrong type, can be reproduced  
> by this program:
> '---------
> dim as Handle offset
> offset = offset*4 // error: invalid operands to binary *
> '---------
> The reason for the error is simple: a Handle is a kind of address,  
> and gcc knows that it is senseless to multiply an address by anything.
This much I knew from previous discussions but personally I've never  
had occasion to work with pixelmaps, so I figured it was better to  
bow out of answering anything so I wouldn't mislead.

>
> It compiles cleanly. So it must be ready to rock-and-roll?
> Well, not if you care about correctness. The inner loop will in  
> general read and write outside the PixMap bounds.
> It's not really possible to traverse a PixMap correctly without  
> obtaining its rowBytes:
> toolbox fn GetPixRowBytes( PixMapHandle pm ) = long
> dim as long offset
> rowBytes = fn GetPixRowBytes( spritePixMapH )
>
> There's also an off-by-one error: the pixel component set in  
> alphaWorld derives from not from the corresponding pixel in  
> spriteWorld, but from its neighbour.

Hopefully, the person that asked me the question is reading your  
explanation Robert.

Thanks....Brian