Page 1 of 1

Boolean init

Posted: 24 January 2010, 17:21 PM
by GTBecker
What's wrong here? (ZX-24n)

Code: Select all

dim ShutterAuto as boolean = True

Sub Main()
	console.write(cstr(ShutterAuto))
end sub

Re: Boolean init

Posted: 24 January 2010, 17:33 PM
by dkinzer
GTBecker wrote:What's wrong here? (ZX-24n)
What are you seeing? The release candidate that we're currently testing compiles that code without error for both native mode and VM mode.

Boolean init

Posted: 24 January 2010, 17:51 PM
by GTBecker
It reports False. The boolean does not seem initialized.

Tom

Re: Boolean init

Posted: 25 January 2010, 9:25 AM
by dkinzer
GTBecker wrote:It reports False. The boolean does not seem initialized.
Confirmed. There is an error in the native mode code generation for the v2.8.x series. The issue was corrected some time ago in our current development version. The correction will be in the upcoming release.

In the mean time, a workaround is to add explicit initialization in Main().

Code: Select all

dim ShutterAuto as boolean

Sub Main()
   ShutterAuto as boolean = True
   console.write(cstr(ShutterAuto))
end sub
An alternate workaround is to install the Beta version posted for the object extension testing.
http://www.zbasic.net/download/ObjExt/Z ... _2-9-4.zip

Boolean init

Posted: 25 January 2010, 9:46 AM
by GTBecker
> ... An alternate workaround is to install the Beta version posted for
the object extension testing.
http://www.zbasic.net/download/ObjExt/Z ... _2-9-4.zip

That one has a SPDR0 error for ZX-24ns, so I'll just set the boolean in
Main. Thanks.

Re: Boolean init

Posted: 25 January 2010, 11:50 AM
by stevech

Code: Select all

dim ShutterAuto as boolean

Sub Main()
   ShutterAuto as boolean = True
   console.write(cstr(ShutterAuto))
end sub
Just wondering: in the above, first line of Main(), is the "as boolean" essential since the variable has been already been declared?

Re: Boolean init

Posted: 25 January 2010, 12:03 PM
by GTBecker

Code: Select all

   ShutterAuto as boolean = True
Surely a typo. That won't compile.

Re: Boolean init

Posted: 25 January 2010, 12:14 PM
by dkinzer
GTBecker wrote:Surely a typo.
Indeed. I didn't review it carefully enough after the copy/paste.