www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Identifying 32 vs 64 bit OS?

reply "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
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?
Aug 10 2014
next sibling parent reply ketmar via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
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).
Aug 10 2014
parent "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
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.
Aug 12 2014
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
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
Aug 10 2014
prev sibling parent reply "Freddy" <Hexagonalstar64 gmail.com> writes:
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.
Aug 11 2014
parent reply "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= writes:
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?
Aug 11 2014
parent ketmar via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
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=20
 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.
Aug 11 2014