GLBasic forum

Main forum => Bug Reports => Topic started by: D2O on 2008-Jun-23

Title: Fehler bei Standart Argumenten und Types
Post by: D2O on 2008-Jun-23
Hi, wenn ich bei folgender Function ein Standart Argument nutze, l_in = 0
kommt das aus dem Debugger.
Quotecompiling:
C:\DOKUME~1\Fabbio\LOKALE~1\Temp\glbasic\gpc_temp1.cpp: In function `__GLBASIC__::Tgraphics __GLBASIC__::Graphics(DGInt)':
C:\DOKUME~1\Fabbio\LOKALE~1\Temp\glbasic\gpc_temp1.cpp:80: error: declaration of 'DGInt l_in' shadows a parameter
*** FATAL ERROR - Bitte die Compiler-Ausgabe ins Forum kopieren

Ohne Standart wert gehts. Bug oder Feature ;)
Code (glbasic) Select

FUNCTION Graphics AS Tgraphics : l_in = 0  //<<<<<<<<<<<<< ??? Fehler, l_in  geht
LOCAL file
LOCAL l_win$
LOCAL temp AS Tgraphics
l_win$  = "window"
LOCAL l_in
IF l_in = 1 //GPX INI
file = DOESFILEEXIST("gamegp2x.ini")
temp.file = file

IF file = FALSE
INIOPEN "gamegp2x.ini"
INIPUT l_win$,"winx",320
INIPUT l_win$,"winy",240
INIPUT l_win$,"winmode",1
INIPUT l_win$,"frame",60
INIOPEN ""

ELSE
INIOPEN  "gamegp2x.ini"   //"game.ini"
temp.x = INTEGER( INIGET$(l_win$,"winx") )
temp.y = INTEGER( INIGET$(l_win$,"winy") )
temp.mode = INTEGER( INIGET$(l_win$,"winmode") )
temp.fps = INTEGER( INIGET$(l_win$,"frame") )


SETSCREEN temp.x,temp.y,temp.mode
LIMITFPS  temp.fps


ENDIF
ELSE  // Windows
file = DOESFILEEXIST("game.ini")
temp.file = file

IF file = FALSE
INIOPEN "game.ini"
INIPUT l_win$,"winx",800
INIPUT l_win$,"winy",600
INIPUT l_win$,"winmode",0
INIPUT l_win$,"frame",100
INIOPEN ""

ELSE
INIOPEN "game.ini"
temp.x = INTEGER( INIGET$(l_win$,"winx") )
temp.y = INTEGER( INIGET$(l_win$,"winy") )
temp.mode = INTEGER( INIGET$(l_win$,"winmode") )
temp.fps = INTEGER( INIGET$(l_win$,"frame") )


SETSCREEN temp.x,temp.y,temp.mode
LIMITFPS  temp.fps


ENDIF



ENDIF

RETURN temp
ENDFUNCTION


TYPE  Tgraphics
x //Breite X
y //höhe y
mode // 0 fenster | 1 vollbild
fps // Framerate festsetzen | -1 ohne Vsync
file // Variable zum überprüfen ob die datei vorhanden ist

ENDTYPE



Edit:// Es muss mit dem Local in der Function zusammen hängen, hier darf man die Variable l_in nicht zusätzlich innerhalb der function als LOCAL declarieren.
Lasse ich das "LOCAL l_in" weg, kann ich wieder standart werte zuweisen.
Muss das so sein ?
Title: Re: Fehler bei Standart Argumenten und Types
Post by: Schranz0r on 2008-Jun-23
Was bringt dir die doppelte deklaration? Da motzt dir jeder Compiler.
Title: Re: Fehler bei Standart Argumenten und Types
Post by: Kitty Hello on 2008-Jun-23
Code (glbasic) Select

FUNCTION foo: a
LOCAL a
ENDFUNCTION

Sei forh, dass er meckert. Sonst würdest Du das LOCAL a verwenden, das ja "0" ist, statt dem Parameter.
Title: Re: Fehler bei Standart Argumenten und Types
Post by: D2O on 2008-Jun-23
Jepp, das ist mir nur vorher nie aufgefallen, da man ja keine Standartwerte hatte.