Moving from 6.04 to 6.10 - integer question

Windows specific forum
BarryG
Addict
Addict
Posts: 4168
Joined: Thu Apr 18, 2019 8:17 am

Moving from 6.04 to 6.10 - integer question

Post by BarryG »

I'm slowly moving from PureBasic 6.04 to 6.10 and boy am I getting lots of crashes with my Windows app. :(

The latest one was because a procedure had .l instead of .i in it for a variable.

This got me thinking: should I just do a search/replace of all .l with .i in my sources? Or just when I get a crash for a procedure or command?
User avatar
mk-soft
Always Here
Always Here
Posts: 6242
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Moving from 6.04 to 6.10 - integer question

Post by mk-soft »

You can use simple variables for everything.
But with structures, this must be controlled.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
BarryG
Addict
Addict
Posts: 4168
Joined: Thu Apr 18, 2019 8:17 am

Re: Moving from 6.04 to 6.10 - integer question

Post by BarryG »

Okay, thanks mk-soft! So keep structures as MSDN specifies them. Got it.

But, the variable I changed wasn't in a structure? It was this code:

Code: Select all

Define pName.i ; Was pName.l before, but this doesn't work with 6.10.

If *pIAcc\get_accValue(vt,@pName)=#S_OK
  *Value\s=Space(SysStringLen_(pName)) ; Crash if .l is used for pName.
  PokeS(@*Value\s,PeekS(pName))
  SysFreeString_(pName)
EndIf
Fred
Administrator
Administrator
Posts: 18199
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Moving from 6.04 to 6.10 - integer question

Post by Fred »

You are getting back a pointer so it must be an integer. The good news here is you are fixing real bugs so your app will be much reliable overall.

Here I never specify the integer type for variable as it's the default, but everyone else can have different habits.
BarryG
Addict
Addict
Posts: 4168
Joined: Thu Apr 18, 2019 8:17 am

Re: Moving from 6.04 to 6.10 - integer question

Post by BarryG »

Good to know that 6.10 is forcing my code to get cleaned up. :lol:
Post Reply