What's the story with 64-bit?

Everything else that doesn't fall into one of the other PB categories.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

What's the story with 64-bit?

Post by PB »

I'm a poor programmer in that I don't own Vista or a 64-bit PC. So, whenever
I see a post with a comment like "you should use always integer for handles"
it concerns me. Currently all my apps store handles in the default type, which
is (or was?) a long. That is, I code it like this: handle=OpenProcess_(). Does
that mean I should now be doing this: handle.i=OpenProcess_() :?:

Or, to put it another way: if I don't change my style, my apps will still run just
fine on 64-bit version of Windows, right? What's the story?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
freak
PureBasic Team
PureBasic Team
Posts: 5962
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

The default type with 4.30 (and therefore PB 64bit) is the integer type, so "handle=OpenProcess_()" will work just fine.

You only need to watch out in places where you added the type (structures for example).
Things like handles, #PB_Any values, PB thread, process, mutex values require the integer type.

All in all it is surprisingly easy to port a program to 64bit.
If you plan to port your stuff to 64bit some day, its not a bad idea to start using .i where you think it may be needed even now. Its less work to do in the future.
quidquid Latine dictum sit altum videtur
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

but a handle.l (long) won't work in 64 bit? Is that what your saying?
Fred
Administrator
Administrator
Posts: 18557
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

That's it. Our advice is to omit the type (unless it's really necessary), so it will stick with the integer one and will save you some headache
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

If you omit the type then in 64 bit its automatically assumed to be .i then, right ?
maw

Post by maw »

SFSxOI wrote:If you omit the type then in 64 bit its automatically assumed to be .i then, right ?
.i is the default type for both x86 and x64 as of PB 4.30.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

maw wrote:
SFSxOI wrote:If you omit the type then in 64 bit its automatically assumed to be .i then, right ?
.i is the default type for both x86 and x64 as of PB 4.30.
and .i is 32bit on x86 and 64bit on x64
oh... and have a nice day.
maw

Post by maw »

Kaeru Gaman wrote:and .i is 32bit on x86 and 64bit on x64
Well, the other way around would have been very confusing :lol:
Post Reply