Hello list:
I am having Stack Overflow problems with this simple code under FreeDOS and
OpenWatcom:
#include stdio.h
char a[8192];
int main()
{
int i;
char b[8192];
for(i=0; i8192; i++) a[i]=b[i]=0;
return 0;
}
I keep getting stack overflow problems.
I know this code is very
wouldnt using memset() be better ?
On Dec 20, 2012, at 10:24 AM, Santiago Almenara wrote:
Hello list:
I am having Stack Overflow problems with this simple code under FreeDOS and
OpenWatcom:
#include stdio.h
char a[8192];
int main()
{
int i;
char b[8192];
AFAIK when you use static tables they are allocated on the stack.
You might want to try allocating them on the heap...
To do so, simply use malloc().
char *a;
a = malloc(8192);
if (a == NULL) return(1);
/* do your stuff */
free(a);
return(0);
cheers,
Mateusz
On 12/20/2012 07:24
First, the good news - Watcom includes code at the start and end of each
function to detect stack overflows. It is a lot easier to debug code
when you know what the root cause of the problem is. If the stack
overflow were to happen and remain silent, you could have all sorts of
strange
Michael:
Where can I find the default size for the watcom stack?
If you use stack=4096, it means the default stack size might be much
smaller than the 16384 I am using.
Santiago
On Thu, Dec 20, 2012 at 2:42 PM, Michael B. Brutman
mbbrut...@brutman.comwrote:
First, the good news - Watcom
Hello list:
asking programming errors on a mailing list that is focused on
operating system development is considered BAD.
I am having Stack Overflow problems with this simple code under FreeDOS and
OpenWatcom:
#include stdio.h
char a[8192];
int main()
{
int i;
char b[8192];
Hi,
On Thu, Dec 20, 2012 at 2:28 PM, Santiago Almenara almen...@gmail.com wrote:
Where can I find the default size for the watcom stack?
Dunno. I think it used to be 4 kb for 16-bit targets, but they may??
have increased it to 16 kb in the meantime.
At 12:58 PM 12/20/2012, Louis Santillan wrote:
The Memory Model (Tiny vs. Small vs. Compact vs. Medium vs. Large,
.COM vs. .EXE) of the compiler could be causing the issue. Some
compilers used to default to Small. What compiler flags are you using?
Even in the TINY model, there is no reason to
On 12/20/2012 2:41 PM, Tom Ehlert wrote:
asking programming errors on a mailing list that is focused on
operating system development is considered BAD.
I don't think we have enough developers (OS or application) or enough
list traffic where we can afford to be picky ...
Mike
On 12/20/2012 3:11 PM, Ralf A. Quint wrote:
At 12:58 PM 12/20/2012, Louis Santillan wrote:
The Memory Model (Tiny vs. Small vs. Compact vs. Medium vs. Large,
.COM vs. .EXE) of the compiler could be causing the issue. Some
compilers used to default to Small. What compiler flags are you using?
At 12:58 PM 12/20/2012, Louis Santillan wrote:
The Memory Model (Tiny vs. Small vs. Compact vs. Medium vs. Large,
.COM vs. .EXE) of the compiler could be causing the issue. Some
compilers used to default to Small. What compiler flags are you using?
Even in the TINY model, there is no reason
asking programming errors on a mailing list that is focused on
operating system development is considered BAD.
I don't think we have enough developers (OS or application) or enough
list traffic where we can afford to be picky ...
this is stillnot the 'programming for dummies' mailing list.
Static/global variables are allocated from the heap. Dynamic variables
(like the b array in your code) are pushed on the stack.
Either use compiler directives to increase stack space or make both arrays
static.
This is not a FreeDOS problem and should not have been posted to this list.
Bruce
13 matches
Mail list logo