in reply to How to find out if it is 32bit or 64bit windows?

This will tell you whether you are running under a 32 or 64-bit version of Perl, which is often more salient information:

C:\test>\perl32\bin\perl -MConfig -le"print $Config{ptrsize}" 4 C:\test>\perl64\bin\perl -MConfig -le"print $Config{ptrsize}" 8

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: How to find out if it is 32bit or 64bit windows?
by davido (Cardinal) on Jun 22, 2011 at 16:22 UTC

    I read your post and re-read the Config docs before replying here, and just want to try to understand a little better.

    You stated that $Config{ptrsize} contains the pointer size of the version of Perl. The Config documentation supports this.

    But since a 32 bit Perl can run within a 64 bit Windows environment, how can he be sure his OS version is 64 bit?

    For example, if he's using 32 bit Perl on a 64 bit windows, wouldn't this method report 32 bit?

    It may not make any difference for his given application. Maybe it's enough to know that he's on 32 bit Perl. But what if the Perl script is making a decision as to whether to install a 32 bit version of some compiled program, or a 64 bit version? The decision wouldn't be guaranteed to be accurate if his basis for deciding is what features Perl was compiled with.

    I could be totally wrong, and am just seeking clarification.


    Dave

      That's why I said: , which is often more salient information.

      Which piece of information is the more salient depends entirely upon the OPs purpose. And until and unless he clarifies that we can never reach a conclusion as to which is the "right answer" to his question. But we've given him ways of determining both, so he can choose for himself.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: How to find out if it is 32bit or 64bit windows?
by Tux (Canon) on Jun 27, 2011 at 05:54 UTC

    That is the long version of how you can see that info :)

    C:\Users\Tux>perl -V:ptrsize ptrsize='4'; C:\Users\Tux>perl -V:ivsize ivsize='4'; C:\Users\Tux>perl -V:nvsize nvsize='8'; C:\Users\Tux>

    Note that ptrsize shows the size of the pointers. The length 8 indicates 64bit pointers. But even on 32bit perl installations, you can have 64bit integers: when perl was built with -Duse64bitint, and long doubles: when perl was built with -Duselongdouble.

    To solve a problem that needs native huge numbers that do not fit in 32bit integers, having a perl that supports 64bit integers is often enough. Here's such a perl on a 32bit Linux with both

    tux > perl -V:ptrsize ptrsize='4'; tux > perl -V:ivsize ivsize='8'; tux > perl -V:nvsize nvsize='12'; tux >

    compare that to a build without -Duselongdouble on the same machine:

    tux > perl5.8.8 -V:ptrsize ptrsize='4'; tux > perl5.8.8 -V:ivsize ivsize='8'; tux > perl5.8.8 -V:nvsize nvsize='8'; tux >

    and this is on 64bit Linux:

    tux > perl -V:ptrsize ptrsize='8'; tux > perl -V:ivsize ivsize='8'; tux > perl -V:nvsize nvsize='16'; tux >

    to complete this info story, -V: accepts perl regular expressions:

    $ perl -V:.*size charsize='1'; d_chsize='undef'; d_malloc_good_size='undef'; d_malloc_size='undef'; doublesize='8'; fpossize='16'; gidsize='4'; i16size='2'; i32size='4'; i64size='8'; i8size='1'; intsize='4'; ivsize='8'; longdblsize='16'; longlongsize='8'; longsize='8'; lseeksize='8'; nvsize='16'; ptrsize='8'; shortsize='2'; sig_size='69'; sizesize='8'; u16size='2'; u32size='4'; u64size='8'; u8size='1'; uidsize='4'; uvsize='8'; $

    Enjoy, Have FUN! H.Merijn
      That is the long version of how you can see that info :)

      Well yeah, but the "short version" isn't much use inside a program.

      For the rest.

      1. I know. The OP may not, be he also may not notice replies to me;
      2. when the OP asks about bits I think you can do no more than take him at his word.

        Generally, when people are concerned with the size of integers or numbers, they ask about them, not bits.

      nvsize='12';

      96-bit reals? I've encountered 32-bit, 64-bit, 80-bit and 128-bit, but never 96-bit. There isn't even an IEEE standard for those is there?

      Googling for "96-bit reals" turned up exactly 3 hits.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        It baffled me too, but as long as it works, and all my wanted CPAN modules work on it, why would I doubt? (a little stripped:)

        Linux 2.6.37.6-35-desktop/#1 HP EliteBook 8540p Core(TM) i5 CPU M 540 + @ 2.53GHz/2534(4) i686 3843 Mb openSUSE 11.4 "Celadon" $ gcc -dumpversion 4.5 $ gcc --version gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585] $ perl -V:.*size charsize='1'; doublesize='8'; fpossize='16'; gidsize='4'; i16size='2'; i32size='4'; i64size='8'; i8size='1'; intsize='4'; ivsize='8'; longdblsize='12'; longlongsize='8'; longsize='4'; lseeksize='8'; nvsize='12'; ptrsize='4'; shortsize='2'; sizesize='4'; u16size='2'; u32size='4'; u64size='8'; u8size='1'; uidsize='4'; uvsize='8'; $ perl -V (stripped) Summary of my perl5 (revision 5 version 14 subversion 1) configuration +: Platform: osname=linux, osvers=2.6.37.6-31-desktop, archname=i686-linux-64in +t-ld config_args='-Duse64bitint -Duselongdouble -des' use64bitint=define, use64bitall=undef, uselongdouble=define cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I +/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/pro/loca +l/include' ccversion='', gccversion='4.5.1 20101208 [gcc-4_5-branch revision +167585]', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, Off +_t='off_t', lseeksize=8 gnulibc_version='2.11.3' Characteristics of this binary (from libperl): Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_INT USE_LARGE_FI +LES USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF

        Enjoy, Have FUN! H.Merijn