Re: bug in the dos32 version?
- Posted by Daniel Berstein <daber at PAIR.COM> May 22, 1998
- 668 views
-----Original Message----- De: Keith B. Devens <Keith83 at SPRYNET.COM> Para: EUPHORIA at cwisserver1.mcs.muohio.edu <EUPHORIA at cwisserver1.mcs.muohio.edu> Fecha: viernes 22 de mayo de 1998 15:40 Asunto: bug in the dos32 version? >I made a (very) simple program to just collect data, like stuff that would >be in an address book. Menu driven, and very basic. The problem is that >after entering two records in, everything has an extra carriage return >after it. I couldn't figure out why it was happening, and then I tried >unning the file with exw.exe and the problem went away, so I assume it's > bug in the Dos32 version. If this is a known bug, I'm sorry to bother >you, but if you didn't know about it I'll be happy to send you the code. Send the code and I'll check it. Without some code (or pseudo code) it's difficult to determine if it's an algorithmic, programming or interpreter error. >Also, is it just me, or are you supposed to access variables from >inside a procedure that you want to be changed when you exit the >procedure 'globally'? i.e. you don't put the variables in the parameter >list? Thanks for your help. Do you mean like Pascal VAR parameters? No. If you want your variable data to be persistant among calls you must declare it OUTSIDE and before the procedure declaration. This makes your variable in-scope (declare it as global and it will never loose scope) when the procedure is called. Ex1: procedure myproc() integer x -- do something with 'x'... end procedure Each time myproc() is called, the value of 'x' is reseted. And when the procedure ends, 'x' no longer exists. Ex2: procedure myproc() -- do something with 'x'... end procedure integer x Euphoria will signal an error message. Variable 'x' isn't in scope inside of myproc(). Ex3: integer x procedure myproc() -- do something with 'x'... end procedure Variable 'x' is in scope within myproc() and also is persistant. Variabl e 'x' is accesible from other functions/procedures as well (if they are declared AFTER variable 'x'). Ex4: integer x procedure myproc() integer x -- do something with 'x'... end procedure Here Euphoria resolves the conflict by using myproc() LOCAL 'x' variable. As a result the outside variable 'x' isn't used/changed by myproc(). Please correct me if my examples/descriptions are wrong. Regards, Daniel Berstein daber at pair.com