X-Comment-To: Stephan Brauss
Hi!
25-Мар-2003 15:52 [EMAIL PROTECTED] (Stephan Brauss) wrote to
[EMAIL PROTECTED]:
SB> until yesterday, I used the freedos kernel build 2024c
SB> together with dosemu-1.0.2. With this environment, the
SB> appended program shows that one byte in main memory allocated
SB> by malloc() is altered as soon as a key is pressed. This byte
Which compiler? If this is Borland's compiler, then there should be
some clarifications:
SB> #define SEGMENTS 7
SB> #define SIZE 65500
#define SIZE 65500u
SB> int *segments[SEGMENTS];
int far* segments[SEGMENTS];
SB> int main () {
SB> int i,j,k;
unsigned i, j, k;
SB> for (i = 0; i < SEGMENTS; i++) {
SB> printf("malloc segment %d\n",i+1);
printf("malloc segment %u\n",i+1);
SB> segments[i]=(int *)malloc(SIZE);
segments [i] = (int far*)farmalloc(SIZE);
[...]
SB> for (;;) {
SB> printf("loop: %d\n",k);
printf("loop: %u\n",k);
SB> printf("segments[%d][%d]=%d\n",i,j,segments[i][j]);
printf("segments[%u][%u]=%d\n",i,j,segments[i][j]);
==^^===============================================================
This email was sent to: [EMAIL PROTECTED]
EASY UNSUBSCRIBE click here: http://topica.com/u/?b1ddyi.b3hwCs.YXJjaGl2
Or send an email to: [EMAIL PROTECTED]
TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
==^^===============================================================