Pointer arithmetic (expressions with integers)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: Pointer arithmetic (expressions with integers)

Post by Psychophanta »

Code: Select all

Structure Arraybyte
  b.b[0]  ; byte
EndStructure
Structure Arrayword
  w.w[0]  ; word
EndStructure
Structure Arraylong
  l.l[0]  ; long
EndStructure
Structure Arrayinteger
  i.i[0]  ; integer
EndStructure
Structure Arrayquad
  q.q[0]  ; quad
EndStructure
Structure Arrayfloat
  f.f[0]  ; float
EndStructure
Structure Arraydouble
  d.d[0]  ; double
EndStructure
Structure Arrayascii
  a.a[0]  ; ascii
EndStructure
Structure Arraycharacter
  c.c[0]  ; character
EndStructure
Structure Arrayunicode
  u.u[0]  ; unicode
EndStructure
Structure Arraystring
  s.s[0]  ; string
EndStructure
Macro MyDim(varname,type,items)
  varname#.Array#type#=AllocateMemory(items#*SizeOf(type#))
EndMacro

MyDim(*x,integer,23)
If *x
  *x\i[2] = 10
  *x\i[5] = 124
EndIf
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Pointer arithmetic (expressions with integers)

Post by luis »

@Psycho

The [0] trick has been already discussed in the thread two years ago, with its shortcomings.
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: Pointer arithmetic (expressions with integers)

Post by Psychophanta »

luis wrote:@Psycho

The [0] trick has been already discussed in the thread two years ago, with its shortcomings.
Ok, but my nick prefix "Psycho" has nothing to do with the english or saxon meaning of "psycho", but with its greek etymology, which is: breath, soul.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply