Page 1 of 1

Moving from 6.04 to 6.10 - integer question

Posted: Sun Mar 03, 2024 2:14 am
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?

Re: Moving from 6.04 to 6.10 - integer question

Posted: Sun Mar 03, 2024 2:42 am
by mk-soft
You can use simple variables for everything.
But with structures, this must be controlled.

Re: Moving from 6.04 to 6.10 - integer question

Posted: Sun Mar 03, 2024 3:05 am
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

Re: Moving from 6.04 to 6.10 - integer question

Posted: Sun Mar 03, 2024 9:02 am
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.

Re: Moving from 6.04 to 6.10 - integer question

Posted: Sun Mar 03, 2024 9:04 am
by BarryG
Good to know that 6.10 is forcing my code to get cleaned up. :lol: