Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c > #1644

Re: VLAs use less stack

From jacob navia <jacob@spamsink.net>
Newsgroups comp.std.c
Subject Re: VLAs use less stack
Date 2012-09-01 22:57 +0200
Organization lccwin
Message-ID <k1tsr0$40h$1@speranza.aioe.org> (permalink)
References <k1q5bu$49h$1@speranza.aioe.org> <k1qgl7$j58$1@news-rocq.inria.fr> <k1tnd8$h6r$1@dont-email.me>

Show all headers | View raw


Le 01/09/12 21:24, John Nagle a écrit :
>     There's also an assumption in some operating systems that the
> stack will grow "slowly".  Under Windows (NT to date),
> stack growth is triggered by a page fault in the next 4K
> block beyond the current stack allocation.  Allocating,
> but not using, a block bigger than 4K on the stack can
> result in a program abort if the next stack access is
> in a block other than the immediately next block.  See
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=644900
> http://support.microsoft.com/kb/100775
>
> This may be why Microsoft doesn't support VLAs
> in C.

This is just not true.

suppose:

int fn(void)
{
	int table[1024+1];
}

This program would crash because the stack exceeds 4096 bytes.

But it doesn't even in Microsoft compiler. In my compiler system
I make a loop 'touching" stack pages at function entry. Of course
that loop is not user visible. Microsoft does a similar thing.

This problem was solved around 1995...

Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-08-31 12:58 +0200
  Re: VLAs use less stack Marc <marc.glisse@gmail.com> - 2012-08-31 14:10 +0000
    Re: VLAs use less stack Marc <marc.glisse@gmail.com> - 2012-08-31 14:13 +0000
    Re: VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-08-31 18:09 +0200
    Re: VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-08-31 18:14 +0200
    Re: VLAs use less stack John Nagle <nagle@animats.com> - 2012-09-01 12:24 -0700
      Re: VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-09-01 22:57 +0200
      Re: VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-09-01 22:59 +0200
  Re: VLAs use less stack Keith Thompson <kst-u@mib.org> - 2012-08-31 11:42 -0700
    Re: VLAs use less stack Marc <marc.glisse@gmail.com> - 2012-09-01 10:18 +0000
      Re: VLAs use less stack Rui Maciel <rui.maciel@gmail.com> - 2012-09-01 19:18 +0100
        Re: VLAs use less stack Marc <marc.glisse@gmail.com> - 2012-09-01 19:19 +0000
        Re: VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-09-01 23:01 +0200
      Re: VLAs use less stack Keith Thompson <kst-u@mib.org> - 2012-09-01 11:36 -0700
        Re: VLAs use less stack Marc <marc.glisse@gmail.com> - 2012-09-01 19:05 +0000
    Re: VLAs use less stack jgk@panix.com (Joe keane) - 2012-09-02 16:56 +0000
      Re: VLAs use less stack Keith Thompson <kst-u@mib.org> - 2012-09-02 14:22 -0700
        Re: VLAs use less stack jgk@panix.com (Joe keane) - 2012-09-04 00:39 +0000
          Re: VLAs use less stack Jens Gustedt <jens.gustedt@loria.fr> - 2012-09-04 10:28 +0200
            Re: VLAs use less stack John Nagle <nagle@animats.com> - 2012-09-04 11:31 -0700
          Re: VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-09-04 17:02 +0200
      Re: VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-09-02 23:28 +0200
      Re: VLAs use less stack Keith Thompson <kst-u@mib.org> - 2012-09-02 14:37 -0700
        Re: VLAs use less stack John Nagle <nagle@animats.com> - 2012-09-02 15:45 -0700
          Re: VLAs use less stack Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-09-04 00:03 +0200
  Re: VLAs use less stack jgk@panix.com (Joe keane) - 2012-09-01 16:09 +0000
    Re: VLAs use less stack Keith Thompson <kst-u@mib.org> - 2012-09-01 11:45 -0700
    Re: VLAs use less stack jacob navia <jacob@spamsink.net> - 2012-09-01 23:05 +0200

csiph-web