[futurebasic] Re: [FB] FBToC 1.4.8 compiling bug

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2010 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Tue, 23 Nov 2010 10:47:01 +1300
Carminati Paolo wrote:

> Try to compile the following:
> 
> dim as byte   buffer(1024)
> 
> local
> local fn ReadBytes ( bytesToRead as unsigned byte, thePtr as ptr )
> end fn
> 
> if (fn ReadBytes ( 2, @buffer )) then beep
> end
> 
> It  will crash...
> Note that if the calling routine isn’t in the “if” statement, it doesn’t crash.
> In other words, fn ReadBytes( 2, @buffer ) doesn’t crash and the correct error is reported.

Thanks, Paolo. I filed a bug report.

FWIW, a pointer to the start of the array is obtained in FB with @buffer(0).
  if ( fn ReadBytes( 2, @buffer(0) ) ) then beep

In C, but not FB, buffer is variable that points to the start of the array.

Robert P.