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.
GTBecker
Posts: 616 Joined: 17 January 2006, 19:59 PM
Location: Cape Coral
Post
by GTBecker » 24 January 2010, 17:21 PM
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
Post
by dkinzer » 24 January 2010, 17:33 PM
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
Post
by GTBecker » 24 January 2010, 17:51 PM
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
Post
by dkinzer » 25 January 2010, 9:25 AM
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
stevech
Posts: 715 Joined: 22 February 2006, 20:56 PM
Post
by stevech » 25 January 2010, 11:50 AM
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
Post
by GTBecker » 25 January 2010, 12:03 PM
Surely a typo. That won't compile.
Tom
dkinzer
Site Admin
Posts: 3120 Joined: 03 September 2005, 13:53 PM
Location: Portland, OR
Post
by dkinzer » 25 January 2010, 12:14 PM
GTBecker wrote: Surely a typo.
Indeed. I didn't review it carefully enough after the copy/paste.
- Don Kinzer