Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [TIER1 BUG] AGK 108.11 - Declaring and initializing a global variable no longer works

Author
Message
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 22nd May 2013 04:11 Edited at: 22nd May 2013 04:37
PROBLEM

AGK 108.11 no longer allows global variables to be declared and initialized, as follows:



After the initializing declaration, the value of "g_iMaxSprites" will be 0, instead of 600.

So, as a consequence, on the following line the array will be initialized to zero elements.
(The incorrect value of g_iMaxSprites caused havoc later in the code where the snippet is from.)

Using AppGameKit 108.11 TIER1 compiler there will be no compiler warnings or errors!
The initialization statement (= 600) after the declaration is simply IGNORED by the compiler.

RECENT CHANGES

The code snippet above used to work with the TIER1 compiler on AppGameKit 107.6!

I've just tried upgrading some older projects from 107.6 to 108.11 but all I've run into is problems.

Code that used to work, no longer does, and I'm getting reduced 2D performance! I'm absolutely distraught!

RELATED ISSUES

Issue 468: Single-line array declaration not functional in 1088 beta
* Reported Jan 15, 2013

Issue 304: Tier 1 basic compiler silently fails to initialize declared variable when using calculated value.
* Reported: May 12, 2012

Issue 35: Global Declarations using math operations produce the wrong result
* Reported: Sep 9, 2011

OTHER FEEDBACK

Amazing how these compiler issues keep resurfacing year after year.

On a positive note, I do have to say I'm pleased to see that Paul has really been working hard lately.
Many of the issues on the AppGameKit issues list have been fixed - or are being worked on. This is great.

But I don't really have time to do free product testing and bug reporting for TGC.
I would actually like to have a stable dev environment that I can use for development. Darnit.

I'll be adding this report to the AppGameKit issues list, as soon as others have confirmed it.
(I'm leaving some room for the possibility that I'm just tired and made a mistake myself.)

FOR TESTERS

I've attached a small .zip file with ready-to-compile source for confirming the bug.

Cheers,
AgentSam

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd May 2013 04:28
If you change 'global g_iMaxSprites as integer = 600' to 'global g_iMaxSprites = 600' does it work?

The variable named 'g_iMaxSprites' is integer by default.

It has been known for a while that you cannot combine explicit typing and initialization in the same line.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 22nd May 2013 04:41
Hi AL,

Yes, it works in both 107.6, and in 108.11, if I remove the explicit type declaration from the statement.

Doesn't really help... what if I wanted to say "global g_fMyFloat as float = 123.456", that would propably still fail. (Going to try that next.)

Also, I prefer to declare the type explicitly! And if that's NOT allowed, there should be a compiler warning in the least.

Last, if it has been known for a while, where has it been reported - I had no success finding any such forum threads, except for the issues I referred to earlier.

Cheers,
AgentSam
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 22nd May 2013 04:53
Here's the revised test code for both declaration types.



The result is that in AppGameKit 107.6 this test compiles and works perfectly.
In AppGameKit 108.11, it fails when using explicit type declarations.

Still looks like a bug to me.

Cheers,
AgentSam
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 22nd May 2013 04:57
Quote: "global g_fMyFloat as float = 123.456"

global b_fMyFloat# = 123.456

It's a known problem for me but I can't quite remeber how that came to be.

swis
Joined: Tue Dec 16th 2008
Interstellar
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 22nd May 2013 05:09
The workaround that I will be employing, is that I will use separate sections for declarations and initializations.
That means I'm going to have to go through every darn global declaration in my existing 107.6 projects.

So, I'm definately not happy about the compiler allowing these types of issues go unnoticed and without warnings.

As a result the program doesn't do what the source code tells it to, and the compiler is quite happy with that!
No warnings, no errors. Nothing, just a zeroed variable when it should be initialized. Argh, the pain.

And of course, I know I have multiple initializing declarations like that. They weren't a problem with 107.6.

(I don't know whether to laugh or cry.)

This might seem like a minor issue, but it's a major failing in the compiler to not catch cases like these.

Cheers,
AgentSam
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd May 2013 16:25
If it worked in v1076 and not in v10811, then it is a bug.

Report it on the google list (using the simplest code sample that works to show the bug).

Maybe the issue is gone in the v10812.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 22nd May 2013 17:01
Issue report is now on the buglist, at
http://code.google.com/p/agk/issues/detail?id=564

Entry also contains a linkback to this thread.

Cheers,
AgentSam
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 22nd May 2013 21:26
But is this not an very old bug since the intel appup compo ?
This appeared after the intel ultrabook fixes to agk?

I Always do it like this anyway after the intel appup Project as there is something in the back of my head about it?

global myspeed
myspeed=600

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd May 2013 21:52
Paul has declared it fixed as of a couple of hours ago. The google issue was labeled as fixed two hours after it was posted by AgentSam.

I guess we'll have to see when the next release comes out.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd May 2013 01:59
Switching back to the faster compiler also fixed this.
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 23rd May 2013 03:45 Edited at: 23rd May 2013 04:38
Ok. Thanks Paul. I'd buy you a few pints of beer if I was there.

Cheers,
AgentSam
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 23rd May 2013 04:38
UPDATE:
Just tested this using the latest AppGameKit 108.12 Beta, and this issue still isn't fixed...

Cheers,
AgentSam
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd May 2013 20:25
Just tested with more recent v10812 download and the issue is fixed.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 23rd May 2013 21:48
AL,

Yea, the problem was with the first published 108.12 download (luckily not many people were fast enough to get it).

I was one of the "early birds", and got hit with the "failed" 108.12 version.

Since then, Paul has uploaded the "fixed" 108.12 version, which is A-ok.

So, yea, now the problem is gone. I'm quite happy with Pauls recent work, actually. Though I'm sure we still manage to find a few more bugs, but it's looking good now.

Cheers,
AgentSam
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd May 2013 22:24
I just posted my day's results in the main v10812 thread.

I am basically happy. All the bits I need to work are working.

And, isn't it amazing what you can find in wikipedia?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th May 2013 04:13
Quote: "And, isn't it amazing what you can find in wikipedia?"

What's more amazing is that a few years ago, a guy managed to compress wikipedia into an offline archive that fits onto an 8gb ipod!

"You're all wrong. You're all idiots." ~Fluffy Rabbit

Login to post a reply

Server time is: 2024-11-24 13:38:22
Your offset time is: 2024-11-24 13:38:22