Got an idea for enhancing PureBasic? New command(s) you'd like to see?
GenRabbit
Enthusiast
Posts: 151 Joined: Wed Dec 31, 2014 5:41 pm
Post
by GenRabbit » Wed Jan 04, 2017 10:59 pm
I'd like to have these posibilities; It would be nice to let the compiler calculate it so You don't have to do it at runtime. (less Variables to keep track of)
Code: Select all
#LENGTH_WORD = 2
DataSection
BeginMaxActorsInGroup:
Data.w 5,10,15,20,25,50,100,250,500,1000
EndMaxActorsInGroup:
Data.l (?EndMaxActorsInGroup - ?BeginMaxActorsInGroup) /#LENGTH_WORD ; This one
EndDataSection
#DataLength = (?EndMaxActorsInGroup - ?BeginMaxActorsInGroup) /#LENGTH_WORD ; This one
GPI
PureBasic Expert
Posts: 1394 Joined: Fri Apr 25, 2003 6:41 pm
Post
by GPI » Thu Jan 05, 2017 11:18 am
I think, the problem is, that address are calculated during realtime. For a human it is easy to see, that the length is a fixed value, but the compiler has problems here.
maybe it is possible to extend the SizeOf()?
SizeOf(BeginMaxActorsInGroup,EndMaxActorsInGroup)
nco2k
Addict
Posts: 1344 Joined: Mon Sep 15, 2003 5:55 am
Post
by nco2k » Thu Jan 05, 2017 1:37 pm
personally i would be happy if we could assign labels to constants in general:
Code: Select all
#Test = ?blahblahblah
DataSection
blahblahblah:
Data.b $74, $65, $73, $74, $00
EndDataSection
dont other languages support something like this? it should be doable.
c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
GenRabbit
Enthusiast
Posts: 151 Joined: Wed Dec 31, 2014 5:41 pm
Post
by GenRabbit » Thu Jan 05, 2017 5:51 pm
I suppose the compiler could flag the variables as it registers them if they are static or dynamic. NCO2K example could be added simultanously
Tenaja
Addict
Posts: 1959 Joined: Tue Nov 09, 2010 10:15 pm
Post
by Tenaja » Mon Jan 09, 2017 3:28 am
nco2k wrote: personally i would be happy if we could assign labels to constants in general:
Code: Select all
#Test = ?blahblahblah
DataSection
blahblahblah:
Data.b $74, $65, $73, $74, $00
EndDataSection
dont other languages support something like this? it should be doable.
c ya,
nco2k
Yes, we have that already.