in reply to Re^7: sorting two arrays together
in thread sorting two arrays together

If you have a 32-bit version of perl available, the results of the same 0.71/0.72 comparison would be interesting.


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^9: sorting two arrays together
by Anonyrnous Monk (Hermit) on Dec 23, 2010 at 06:18 UTC

    32-bit versions1 seem to be ok.  Both 0.71 and 0.72 print (consistently):

    9175224 4194672

    While I was at it, I also tried a few more 64-bit versions on other machines (5.10.0, 5.10.1, 5.12.22). All exhibited the same wonkiness mentioned earlier. So it clearly seems to be a 64-bit incompatibility.

    Two more notes:

    (1)  In your Makefile.PL you have a line

    LIBS => $Config{cc} eq 'gcc' || $Config{cc} eq 'cc' ? ['-lstdc++'] : + '',

    With some of the perls I had tried, $Config{cc} was set to an absolute path '/usr/local/bin/gcc', or to 'gcc ' (yes, with a trailing space - not sure where this came from, I didn't knowingly put it there). So, your check didn't match, and libstdc++ wasn't linked in, which in turn led to the usual undefined reference to '__gxx_personality_v0' when Dynaloader tried to load the .so file.

    Something like the following might be slightly more robust:

    LIBS => $Config{cc} =~ /\bg?cc\s*$/ ? ['-lstdc++'] : '',

    (2)  When trying to build Devel-Size-0.72 for 5.12.2 with a more recent and picky gcc (v4.3.2), I got the following errors:

    Size.xs: In function 'UV thing_size(const SV*, char* (*)[8192])': Size.xs:552: error: invalid conversion from 'const void*' to 'void*' Size.xs:553: error: invalid conversion from 'const void*' to 'void*' Size.xs:554: error: invalid conversion from 'const void*' to 'void*' make: *** [Size.o] Error 1

    Explicitly casting thing to non-const void* 'fixed' it:

    /* Is there something hanging off the arylen element? */ if (AvARYLEN((void*)thing)) { if (check_new(tv, AvARYLEN((void*)thing))) { total_size += thing_size(AvARYLEN((void*)thing), tv);

    __________

    And here the 'perl -V's, just in case:

    1)

    2)

      64-bit bug now fixed and will be on CPAN once I've had it tested on *nix and regression on 32-bit builds.

      c:\test>perl -MDevel::Size71=total_size -E"$a[$_]=1 for 1..1e6; say total_size( \@a )" 32388768 c:\test>perl -MDevel::Size=total_size -E"$a[$_]=1 for 1..1e6; say total_size( \@a )" 32388768 c:\test>perl -MDevel::Size71=total_size -E"$a[$_]=[1,1] for 1..5e5; say total_size( \@a )" 104194464 c:\test>perl -MDevel::Size=total_size -E"$a[$_]=[1,1] for 1..5e5; say total_size( \@a )" 104194464

      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.