Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Limitation of Array

Expand Messages
  • merlyn@stonehenge.com
    ... Jenda From: merlyn@stonehenge.com ... Vijaya How many elements can be stored in an array? I mean, is there any Vijaya maximum limit for an array? If
    Message 1 of 4 , Mar 6, 2008
    • 0 Attachment
      >>>>> "Jenda" == Jenda Krynicky <Jenda@...> writes:

      Jenda> From: merlyn@...
      >> >>>>> "Vijaya" == Vijaya Kumar <mp_vijayakumar@...> writes:
      >>
      Vijaya> How many elements can be stored in an array? I mean, is there any
      Vijaya> maximum limit for an array? If anybody knows, please answer.
      >>
      >> Perl imposes no limits, but it's certainly limited to whatever fits into the
      >> addressing space of a process on your system, because data is all
      >> memory-resident.

      Jenda> I kinda doubt it. The index of an array is an integer so I'd expect
      Jenda> the maximum limit to be your size of integers.

      Jenda> Which means
      Jenda> use Config;
      Jenda> $maxint = 2 ** ($Config{intsize}*8 - 1);

      Jenda> The limit looks way big enough so I doubt Perl bothers to check
      Jenda> whether it needs to promote to something bigger as the array grows.

      But I believe the standard "integer" size is always supposed to exceed the
      number of addressable bytes for a given architecture. Given that each Perl
      Scalar is some number (16?) bytes at a minimum, you already lose a few bits
      worth of the number of possible scalars, so I think you're in the clear.

      --
      Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
      <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
      Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
      See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    Your message has been successfully submitted and would be delivered to recipients shortly.