Mail Archives: djgpp/1997/06/15/14:48:46
Jawed Karim wrote:
>
> I really need the following code to work. Under Linux, this works
> PERFECTLY. Under DJGPP I get SIGSEVs every single time. See for
> yourself:
>
> --
> #include <stdio.h>
>
> typedef struct {
> int r, g, b;
> int closest_fit;
> } Table;
let's see, sizeof(Table) is 16.
>
> main()
> {
> Table thingy[255][128];
> }
> ---
you are asking for 255*128*16 = 510 K of memory from the stack. AFAIK,
djgpp programs have a default stack size of 256 K. you can use the
program stubedit in you bin directory to change this value. that said, i
do not think it is a good idea to allocate so much memory from the
stack.
> It doesnt crash with [255][32] but it does with [255][64]. In any
> case, even with 128 it SHOULD NOT. It's not that much memory, and
because with 32, you are asking for 127.5 K and with 64 K, you are
asking for 255 K. it is not that much memory to allocate on the heap,
but not when it comes to the stack.
> under linux gcc it works. Any ideas?
so, under linux, the default stack size must be larger.
> Please email me directly...
will do. however, i would appreciate it if you do not do the same. i can
read the newsgroup fine.
BTW, if you look at the trace, it tells you
> Stack Fault at eip=00001559
i would urge everyone to first think before blaming djgpp, cwsdpmi etc
for all their woes.
--
Sinan
*******************************************************************
A. Sinan Unur WWWWWW
|--O+O
mailto:sinan DOT unur AT cornell DOT edu C ^
http://www.people.cornell.edu/pages/asu1/ \ ~/
Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************
- Raw text -