CONFIG SUBMODE/de

(Difference between revisions)
Jump to: navigation, search
m (1 revision)
((**COPIED FROM ENGLISH PAGE**) =)
Line 1: Line 1:
== (**COPIED FROM ENGLISH PAGE**) === <span class="f_Header">Action</span> =
+
= <span class="f_Header">Funktion</span> =
  
This option sets how the compiler deals with Subs, Functions and Declarations.
+
Diese Option definiert wie der Compiler mit Subroutinen, Funktionen und Deklarationen umgeht.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>

Revision as of 00:03, 13 March 2013

Contents

Funktion

Diese Option definiert wie der Compiler mit Subroutinen, Funktionen und Deklarationen umgeht.

 

 

Syntax

CONFIG SUBMODE = NEW|OLD

 

 

Remarks

When the SUBMODE option is not configured, the default 'OLD' will be used.

This is the old mode used in versions up to 2070.

This old mode demands that you DECLARE a function or sub, before you call it.

It also binds in the sub/function at the same location as in your code.

When working with $include files, this requires that you put the $include file at the end of your code, and that you put an $include file at the start of your code.  Or that you use a GOTO to jump over the Sub/Function code.

 

When you use CONFIG SUBMODE=NEW, most behaviour is changed :

- there is no need to DECLARE a sub/function before you call it. But, the actual sub/function code must be placed before the actual call!

- only the used sub/functions are included

- the sub/function code is placed after the main program. this is something you do not need to worry about.

- you can $include the modules without a GOTO to jump over the code.

- sub/functions behave like macro's : only when used they are included

 

 

 

See also

DECLARE SUBSUBDECLARE FUNCTION , CALL

 

 

Example


$regfile = "m88def.dat"
$crystal = 8000000
config submode=new
 
declare sub test1() ' not required
 
sub test2() ' this sub is not used and will not be compiled
 print "test2"
end sub
 
function myfunc() as byte ' called from test1
 myfunc = 1
end function
 
sub test1()
 print "test1"
 print myfunc() ' uses myfunc
end sub
 
 
print "test"
test1 ' call test1
end '12

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language