English
Forum & Help

Infinity-Profan News

Proc-Parameter type aray Übergabe byVal instead of byRef

 
yet get Arrays as Procedures-Parameter byRef instead of byVal transfer, means only The address instead of a copy. this is of course faster, can but To unexpected Ergebnissen lead in a slight To erlernenden Language.

now go Arrays as Procedures-Parameter standardmäßig byVal transfer, except one setting one @ to whom Variablennamen in the Parameterdeklarationsanweisung:

standard, byVal:
var a=[10 20 30]
Test a
print a// gives 10,20,30 from

proc Test a

    a[0]=55

endproc


If byRef erwünscht (faster):
var a=[10 20 30]
Test a
print a// gives 55,20,30 from

proc Test @a

    a[0]=55

endproc


On Parameter, The not of type aray transfer go, has @ none Einfluss, however becomes The check for this Parameter on a aray-copy at settle the @-Zeichens shorted.

with functions, with them it on supreme speed ankommt, is means a optimization by @ for each Parameter with einzubeziehen.

deference:

an similar entrapment is simple allocate Array=Array:
var a b=[10 20 30]
a=b
a[0]=55
print b// shows 55,20,30 though b syntaktisch not manipulating watts

want is a copy of a aray for such Zuweisungen, then can for The function arr uses go:
var a b=[10 20 30]
a=arr(b)
a[0]=55
print b// shows 10,20,30
print a// shows 55,20,30
 
01/11/16  
 




HofK
If
@parameter
in the Prozedurdefinition this Parameter as "At resse" -mistake in writing aware- commit, means The reference on the Parameter, ought to one my, that a=b for arrays too The copy of b to a bring and then a=@b The reference commit. so bräuchte one here no arr().

what speaks against it? what übersehe I thereby?
 
01/12/16  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.740 Views

Untitledvor 0 min.
p.specht06/10/21
rafl12/26/20
rquindt05/11/18
Micha1233406/19/16
More...

Themeninformationen

this Topic has 2 subscriber:

HofK (1x)
iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie