Mail Archives: djgpp/1992/12/30/02:57:42
On my machine (ALR 486, 12MB) the following program performs
18 loops and then hangs the computer. To be more precise: after the
18-th loop, the system begins to grab virtual memory. Running it with
debug32, I had to reboot when more than 15MB virtual memory were used.
If you comment out the
cin >> ch;
line, the program runs fine.
The problem is the same with djgpp 1.09 and 1.08.
Is this a problem with I/O stream interaction?
Henning
//-------------------------------------------------------------------------
//
// compile: gcc -v -g error.cc
//
// error.cc
//
#include <iostream.h>
const int q = 3;
void Next(int nr, double *sv){
int i;
char ch;
cout << "Input: ";
cin >> ch;
cout << nr << "\n";
for (i = 0; i <= q; i++)
cout << "a" << i << ": " << sv[i] << "\n" ;
}
int main(){
int i, nr, n = 130;
double sv[q+1];
for (i=0; i<=q; i++)
sv[i] = 0.0;
for(nr=0; nr<=n; nr++)
Next(nr, sv);
}
- Raw text -