Problems with word array in a unit.

General discussion on mikroPascal.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Problems with word array in a unit.

#1 Post by Dany » 09 Sep 2008 18:07

Hi, there is apparently a problem in mP 8.0.0.1 when accessting arrays that are declared in a "unit" (not the main project file).

This code works (as could expected):

Code: Select all

const BtMask: array[0..15] of word = (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768);
....
JWrd := BtMask[7];
gives the value "128" in the variable "JWrd" (which is declared as a word).

When however "BtMask" is declared in another unit, "JWrd" gets filled with "512" in stead of "128". :(

The problem does not occur with byte arrays declared in a "unit". :D

Another finding:

Code: Select all

I := 7;
JWrd := BtMask[I];
works fine.

Any idea? Thanks in advance. :-)
I did place a post with the support desk also.

p.s. I think this type of issue is there already for a while now, see http://www.mikroe.com/forum/viewtopic.p ... const+unit :(

Reply from the mE support desk:
Successfully reproduced this problem, and informed our software developers about this issue. They will fix this in coming releases of mikroPascal compiler.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: Problems with word array in a unit.

#2 Post by zristic » 25 Mar 2009 15:41

Fixed in the PRO version.
Thanks for the report.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#3 Post by Dany » 25 Mar 2009 16:25

Thanks! :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal General”