IndexOf(MyStruct,i.l)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

IndexOf(MyStruct,i.l)

Post by Flype »

Just an idea while i'm programming...

you know SizeOf(MyStruct)
you know OffsetOf(MyStruct/fieldName)

what about IndexOf(MyStruct,index.l)

a little snippet, for showing what i'm talking about:

Code: Select all

Structure PEOPLE
  firstName.s
  nickName.s
  birthDate.s
  comment.s
EndStructure

MyItem.PEOPLE

For i=0 To 3
  Debug IndexOf(MyItem,i) ; for easy field-debugging
Next

line$ = ""

For i=0 To 3
  line$ + IndexOf(MyItem,i) + Chr(10) ; for easy field-appending
Next

AddGadgetItem(#ListIcon,-1,line$)
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

i think its ok, when you have posted it in the v4 wishlist :wink: and people can discuss there :wink:
viewtopic.php?t=7853&start=165
:D
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

This will be not possible, as we don't have a runtime information on each structure to do that (OffsetOf() and SizeOf() are compiler directives which are evaluated at compile-time, not runtime).
Post Reply