Thread overview
Identifying 32 vs 64 bit OS?
Aug 11, 2014
Jeremy DeHaan
Aug 11, 2014
ketmar
Aug 12, 2014
Jeremy DeHaan
Aug 11, 2014
Jacob Carlborg
Aug 11, 2014
Freddy
Aug 11, 2014
ketmar
August 11, 2014
I am looking at these versions as described here: http://dlang.org/version.html

There are X86 and X86_64 version identifiers, but these specifically mention that they are versions for the processor type. Can they also be used to determine if the OS is running in 32 vs 64 bits?
August 11, 2014
On Mon, 11 Aug 2014 05:18:59 +0000
Jeremy DeHaan via Digitalmars-d-learn
<digitalmars-d-learn@puremagic.com> wrote:

why do you need that info? D types has well-defined sizes (i.e uint is
always 32 bits, and so on).

you still can check pointer size -- (void *).sizeof. but i'm pretty
sure that you don't really need to do that unless you want to store
pointers in files (and this is almost completely useless anyway).


August 11, 2014
On 11/08/14 07:18, Jeremy DeHaan wrote:
> I am looking at these versions as described here:
> http://dlang.org/version.html
>
> There are X86 and X86_64 version identifiers, but these specifically
> mention that they are versions for the processor type. Can they also be
> used to determine if the OS is running in 32 vs 64 bits?

Use "D_LP64". This indicates pointers are 64 bits.

-- 
/Jacob Carlborg
August 11, 2014
On Monday, 11 August 2014 at 05:19:01 UTC, Jeremy DeHaan wrote:
> I am looking at these versions as described here: http://dlang.org/version.html
>
> There are X86 and X86_64 version identifiers, but these specifically mention that they are versions for the processor type. Can they also be used to determine if the OS is running in 32 vs 64 bits?
They mean what the integer(or pointer) size for the executable code
generated(change able with -m(32|64)) is when compiled. If you want to check if
the target OS(not your code) is running 32 vs 64 bit you have to do system call for your target OS.
August 11, 2014
On Monday, 11 August 2014 at 07:58:15 UTC, Freddy wrote:
> If you want to check if
> the target OS(not your code) is running 32 vs 64 bit you have to do system call for your target OS.

Not the OS, but a special CPU instruction: isX86_64() in core.cpuid?
August 11, 2014
On Mon, 11 Aug 2014 12:51:40 +0000
via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:

> Not the OS, but a special CPU instruction: isX86_64() in core.cpuid?
but there is ARM64 coming. and gdc, for example, will has no problems to support it "out of the box" due to using gcc cogegen. yes, i know that runtime should be fixed to, but what i want to say is: please, stop thinking that there is Only One 64-bit CPU.


August 12, 2014
On Monday, 11 August 2014 at 06:17:22 UTC, ketmar via Digitalmars-d-learn wrote:
> On Mon, 11 Aug 2014 05:18:59 +0000
> Jeremy DeHaan via Digitalmars-d-learn
> <digitalmars-d-learn@puremagic.com> wrote:
>
> why do you need that info? D types has well-defined sizes (i.e uint is
> always 32 bits, and so on).

I came up with a better solution for what I actually needed, but I was toying with some things in a rdmd build script for different kinds of compilation.