How do you Detect 32-bit or 64-bit Compiler Versions?

Just starting out? Need help? Post your questions and find answers here.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: How do you Detect 32-bit or 64-bit Compiler Versions?

Post by Little John »

Josh wrote:@Dude
It is not a good behavior to extend a thread with a question that has nothing to do with the original topic. It'll only lead to confusion like this.
Well, I think it is consequent: It was he who extended this thread and now it is he who is confused ... :mrgreen:
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: How do you Detect 32-bit or 64-bit Compiler Versions?

Post by Dude »

Sorry Mijikai and Little John; I misunderstood what was happening with SizeOf(). I'll take my leave now.
Jeff88
New User
New User
Posts: 8
Joined: Thu Jan 03, 2019 3:05 am

Re: How do you Detect 32-bit or 64-bit Compiler Versions?

Post by Jeff88 »

How about testing length of default integers. Code below shows the difference.

Code: Select all

[/Dim a(2)          ;64-bit systems each element is 8 bytes
Dim b.l(2)        ;32-bit systems each element is 4 bytes like this
a(1)=-1
b(1)=-1
Debug PeekB(@a(1)+4)   ;5th byte of 8 bit word
Debug PeekB(@b(1)+4)   ;1st byte of next 4 bit word
End
code]
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: How do you Detect 32-bit or 64-bit Compiler Versions?

Post by Josh »

Jeff88 wrote:How about testing length of default integers
For this you can use:

Code: Select all

SizeOf (Integer)
SizeOf() can also be used with CompilerIf.
sorry for my bad english
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: How do you Detect 32-bit or 64-bit Compiler Versions?

Post by Olliv »

As said by Mijikai earlier
Mijikai wrote:How about:

Code: Select all

Debug SizeOf(Integer)
Thank you Little John for cross-platform giving.
Maybe CPUID asm op could allow including Mac and pass API.
Post Reply