Boolean init

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Boolean init

Post by GTBecker »

What's wrong here? (ZX-24n)

Code: Select all

dim ShutterAuto as boolean = True

Sub Main()
	console.write(cstr(ShutterAuto))
end sub
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Boolean init

Post 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.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Boolean init

Post by GTBecker »

It reports False. The boolean does not seem initialized.

Tom
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Boolean init

Post 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
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Boolean init

Post 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.
Tom
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

Re: Boolean init

Post 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?
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Re: Boolean init

Post by GTBecker »

Code: Select all

   ShutterAuto as boolean = True
Surely a typo. That won't compile.
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Boolean init

Post by dkinzer »

GTBecker wrote:Surely a typo.
Indeed. I didn't review it carefully enough after the copy/paste.
- Don Kinzer
Post Reply