DEFFN bug

DEFFN bug

Messagede lp060 » Lun 29 Oct 2012 14:23

A long time ago I had some listing I made that when compiled would not run correctly, but in the editor it was fine. Removing a DEFFN solved it at the time, but I lost the listing and thus my test case and never figured out exactly why it failed. I have just now accidentally rediscovered the problem. If you place DEFFN directly after a PROCEDURE or FUNCTION definition then it fails compiled. :shock:

Furthermore this bug only occurs if the PROCEDURE or FUNCTION definition has no parameters.

Example:
Code: Tout sélectionner
' works in the editor, but not compiled
' insert one line of code above the DEFFN, then it works compiled
@test
EDIT
PROCEDURE test
  DEFFN dummy=0
  PRINT "test"
RETURN

If you are using DEFFN, be very careful where you place them.
Avatar de l’utilisateur
lp060
 
Messages: 144
Inscription: Dim 14 Déc 2008 23:12
Localisation: My desk

Re: DEFFN bug

Messagede lp060 » Dim 4 Nov 2012 22:13

After a lot of study in the compiler sources, this is now fixed. I still recommend not placing DEFFN inside subroutines. The compiler generates very ugly code if they are, with BRA instructions jumping over them. :P
Avatar de l’utilisateur
lp060
 
Messages: 144
Inscription: Dim 14 Déc 2008 23:12
Localisation: My desk


Retourner vers English section

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité

cron