Mail Archives: cygwin/1996/12/03/20:35:18
dahms AT ifk20 DOT mach DOT uni-karlsruhe DOT de wrote:
>
> Hi Pascal, you wrote:
>
> : #define ARRAY_SIZE 2038010
> :
> : int
> : main (void)
> : {
> : char A [ARRAY_SIZE];
> : }
>
> : (bug.exe 1000) exception is: STATUS_STACK_OVERFLOW
>
> The problem is not b16, but that automatic arrays are allocated on the stack.
This is in a sense a bug in the ANSI/ISO C spec, which says nothing
about a limit on the size of auto objects other than the limit on
objects in general (which is an implementation-defined matter).
Nor is it able to, since a) the limit depends upon the current stack
depth and b) the stack model isn't explicit in the spec.
But just because the spec doesn't give a limit, that doesn't mean there
isn't one! Just what result is M. Obry expecting? It can't be a
compile-time error, because the limit varies according to available
memory and stack depth. It can't be a null return from malloc,
since malloc wasn't called. If the complaint is simply that,
in addition to the stack overflow exception, memory gets overwritten,
that is a consequence of no access protection for that memory,
and for the fact that no one wants to pay for the cost of checking
the current stack depth on every allocation of local variables.
If you don't like memory corruption, you might try another OS.
"Dr., it hurts when I do this." "Then don't do that."
--
<J Q B>
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -