'Helfer Makros #Define NULL Cast(Any Ptr, 0) #Define ByRefNull(variable) *Cast(TypeOf(variable) Ptr, 0) #Define SetNull(variable) @variable = Cast(TypeOf(variable) Ptr, 0) #Define CheckNull(variable) IIf(@variable = Cast(TypeOf(variable) Ptr, 0), TRUE, FALSE) #Define CreateByRef(variable) *(New TypeOf(variable)) #Define CreateByRefValue(variable, value) *(New TypeOf(variable)) : variable = value #Define FreeByRef(variable) Delete @variable : @variable = Cast(TypeOf(variable) Ptr, 0) 'NULL-Initialisierung und erste Abfrage Dim ByRef As Integer foo = ByRefNull(foo) If CheckNull(foo) Then Print "ist null", @foo Else Print "ist nicht null", foo, @foo EndIf 'Tatsächlichen Wert setzen Dim As Integer bar = 5 @foo = @bar 'Syntax ist bisschen seltsam, aber doch logisch und was besseres fällt mir auch nicht ein If CheckNull(foo) Then Print "ist null", @foo, @bar Else Print "ist nicht null", foo, @foo, bar, @bar EndIf 'Und nochmal NULL setzen SetNull(foo) If CheckNull(foo) Then Print "ist null", @foo Else Print "ist nicht null", foo, @foo EndIf 'Neue ByRef Variable erstellen Dim ByRef As Integer foobar = CreateByRefValue(foobar, 7) 'oder schlicht CreateByRef(foobar) If CheckNull(foobar) Then Print "ist null", @foobar Else Print "ist nicht null", foobar, @foobar EndIf 'Und gleich wieder zerstören FreeByRef(foobar) If CheckNull(foobar) Then Print "ist null", @foobar Else Print "ist nicht null", foobar, @foobar EndIf Sleep