Strange DIM array error and new project time is wrong.

Previous topic - Next topic

Ian Price

I've just tried writing a simple map editor (as a new project) with version 8.078 and noticed that DIM is giving an error - I tried the DIM help demo - that errors too . However, trying out a game written in an older version of GLB that uses DIM doesn't cause any such problem.

Here's the demo code (as supplied by the HELP file) -

Code (glbasic) Select

DIM array[8][8]
FOR x=0 TO 7
    FOR y=0 TO 7
        array[x][y] = x*100 + y
    NEXT
NEXT

PRINT array[4][5], 100, 100
SHOWSCREEN
MOUSEWAIT


The problem occurs if you use single or multi-dimensional arrays.

[EDIT] The problem is resolved by using -
Code (glbasic) Select
GLOBAL array[]
before using DIM, but i never had to do this in the past.

I also noticed that the date is wrong when creating a new project (unless I've gone back in time). The code at the top of the project states -

Code (glbasic) Select

// Project: test
// Start: Thursday, January 01, 1970
// IDE Version: 8.078


My pc clock is correct, so it's not that.
I came. I saw. I played.

MrTAToad

I tried the code directly, and it works okay - with explicit declarations off.  With them on you get the message saying the variables aren't defined.  Once they are, it all works.

And yes, the date in new projects is wrong - wasn't even born in 1970...


Slydog

I wonder if the 'Explicit Declarations' checkbox default was changed between versions?
It should default to force explicit declarations in my opinion, saves on potential head-aches!

I remember that day, it felt like the end of the 60's!  (kidding, wasn't born till LATER that year - which I vaguely remember!)

And that date is the '0' date for some systems (what you get when you convert a date value of '0').
Must be a bug somewhere.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Ian Price

QuoteI wonder if the 'Explicit Declarations' checkbox default was changed between versions?
That's what it looks like.

QuoteAnd that date is the '0' date for some systems (what you get when you convert a date value of '0').
Must be a bug somewhere.
Yep. Hence my bug report.
I came. I saw. I played.

Kitty Hello

Code (glbasic) Select

CTime time;
time = CTime::GetCurrentTime();
CString str, str2=time.Format("// Start: %A, %B %d, %Y\r\n");

Guess which of these 3 lines was missing...  :-[

MrTAToad

Wont be the first - would get compiling errors.  Wouldn't be the last one as you would get compiling errors and garbage.

Therefore it must be the second!

What do I win ??  :coke:

Kitty Hello

Aye,  :coke:. I had the time object uninitialized, displaying the "0" date which seems around 1970.