Re: Array size limits
From: Carol Depore (nobody_at_nowhere.com)
Date: 08/31/04
- Next message: Jack Klein: "Re: C 99 compiler access"
- Previous message: Kay: "Linked lisd storing a queue"
- In reply to: Jack Klein: "Re: Array size limits"
- Next in thread: Ben Pfaff: "Re: Array size limits"
- Reply: Ben Pfaff: "Re: Array size limits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 31 Aug 2004 03:27:55 GMT
On Mon, 30 Aug 2004 21:48:07 -0500, Jack Klein <jackklein@spamcop.net>
wrote:
>On Tue, 31 Aug 2004 02:08:08 GMT, Carol Depore <nobody@nowhere.com>
>wrote in comp.lang.c:
>
>> How do I determine the maximum array size?
>
>You can't
>
>> For example, int a[10000] works, but a[10000000] does not (run time
>> error).
>>
>> Thank you.
>
>The original C standard (ANSI 1989/ISO 1990) required that a compiler
>successfully translate at least one program containing at least one
>example of a set of environmental limits. One of those limits was
>being able to create an object of at least 32,767 bytes.
>
>This minimum limit was raised in the 1999 update to the C standard to
>be at least 65,535 bytes.
>
>No C implementation is required to provide for objects greater than
>that size, which means that they don't need to allow for an array of
>ints greater than (int)(65535 / sizeof(int)).
So...are you saying that I am guaranteed at least int a[65535], but no
guarantees beyond that?
>
>In very practical terms, on modern computers, it is not possible to
>say in advance how large an array can be created. It can depend on
>things like the amount of physical memory installed in the computer,
>the amount of virtual memory provided by the OS, the number of other
>tasks, drivers, and programs already running and how much memory that
>are using. So your program may be able to use more or less memory
>running today than it could use yesterday or it will be able to use
>tomorrow.
>
>Many platforms place their strictest limits on automatic objects, that
>is those defined inside of a function without the use of the 'static'
>keyword. On some platforms you can create larger arrays if they are
>static or by dynamic allocation.
- Next message: Jack Klein: "Re: C 99 compiler access"
- Previous message: Kay: "Linked lisd storing a queue"
- In reply to: Jack Klein: "Re: Array size limits"
- Next in thread: Ben Pfaff: "Re: Array size limits"
- Reply: Ben Pfaff: "Re: Array size limits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|