[futurebasic] Re: [FB] PG error ?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 1999 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Fri, 9 Apr 1999 22:07:23 +1200
>> >(1) There is a mistake in your function name. FN buildGWorld(@rectPtr&)
>> >should be FN buildGWorld&(@rectPtr&), so that it can return a LONG value
>> >(END FN = theWorld&).
>>
>> The function in PG has no '&' in the function name.
>
>
>FB function return types default to long, so this isn't required.

Thanks, Derek, for pointing out this seriously little-known fact. You are
absolutely right, and I wish I hadn't already typed a "&" character as a
name-suffix for ooh it must be thousands of LOCAL FNs returning a LONG.

On investigation, the story turns out to have an unexpected twist. The
following three FNs compile to exactly the same 68K code.

LOCAL FN myLongFN&
END FN =_maxLong

LOCAL FN myIntFN%
END FN =_maxLong

LOCAL FN myDefaultFN
END FN =_maxLong

The suffix makes _nil difference to the code. And so you only need a
name-suffix when returning a string ($) or floating point value (! or #).

Robert