Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using constants not allowed in DATAs
#1
Hi!
Another bug or at least improvement, sorry!
When I create constants, such as:
const DCMD_EOD                            as ubyte = 100
const DCMD_LINE                           as ubyte = 101
const DCMD_CIRCLE                         as ubyte = 102
const DCMD_FILL                           as ubyte = 103
const DCMD_UDG                            as ubyte = 104

And then try to use them like so (initializer expression):
sub draw_presentation()
    dim pic_data(11) as ubyte => { _
        DCMD_Circle, 50, 180, 10,  _
        DCMD_Fill, 50, 180,        _
        DCMD_Circle, 100, 160, 25, _
        DCMD_EOD }
   
    draw_pic( pic_data )
end sub

Or maybe like so (DATAs):
LocPics:
    ' Loc 0 - Limbo
    data DCMD_Line, 0, 180, 250, 100, _
        DCMD_Line, 250, 180, 0, 100, _
        DCMD_EOD

    ' Loc 1 - Landing
    data DCMD_Circle, 50, 180, 10,  _
        DCMD_Fill, 50, 180,        _
        DCMD_Circle, 100, 160, 25,  _
        DCMD_EOD

I receive the following errors:
For the use of constants inside DATAs:
locs.bas:64: warning: [W100] Using default implicit type 'float' for 'DCMD_Line'
locs.bas:69: warning: [W100] Using default implicit type 'float' for 'DCMD_Circle'
locs.bas:70: warning: [W100] Using default implicit type 'float' for 'DCMD_Fill'

This doesn't make any sense, since they are defined as constants of type ubyte.
For the use of these constants inside the constant initializer for an array:
reveni.bas:14: error: Initializer expression is not constant.
reveni.bas:19: warning: [W100] Using default implicit type 'float' for 'pic_data'
reveni.bas:19: error: Invalid argument 'pic_data'

Again, this doesn't make any sense, since they are constants but the initializer expression is erroneously detected as non-constant.
Could this be solved?
Thanks,
-- Baltasar
Reply


Messages In This Thread
Using constants not allowed in DATAs - by baltasarq - 03-03-2025, 09:10 PM

Forum Jump:


Users browsing this thread: 9 Guest(s)