Function = 0 added to message handler since version 3.74 ?

Started by Jean-pierre Leroy, August 04, 2015, 09:14:24 AM

Previous topic - Next topic

Jean-pierre Leroy

Dear all,

I updated FireFly for PowerBASIC recently to the latest version available (3.74).

I could be wrong, but since this update, it seems that a new line is added à the end of the functions associated to a message handler:

Example:


'--------------------------------------------------------------------------------
Function TASK_MINUTES_EN_CHANGE ( _
                                ControlIndex   As Long,  _  ' index in Control Array
                                hWndForm       As Dword, _  ' handle of Form
                                hWndControl    As Dword, _  ' handle of Control
                                idTextControl  As Long   _  ' identifier of text control
                                ) As Long

   Function = 0   ' change according to your needs
End Function


did you notice this ? is-it intentional ?

Thanks
Jean-Pierre

Paul Squires

Yes, this is intentional. By default, PowerBASIC will return 0 from the functions (you do not have to explicitly set the return value), however for FreeBASIC you must set the return value otherwise the compiler will issue a warning message. In order to keep things simple between PB and FB code generation, I decided to output the Function = 0 code for both.
Paul Squires
PlanetSquires Software

Jean-pierre Leroy

Hi Paul,

Thank you for the explanation.

That makes sense.

Regards
Jean-Pierre