Removing Memory Errors from 64-bit Platforms
by Rich Newman

Example 1:


main(argc, argv)                    /* line 1 */ 
int argc;                           /* line 2 */ 
char *argv[];                       /* line 3 */ 
{                                   /* line 4 */ 
  int c=0;                          /* line 5 */ 
                                    /* line 6 */ 
    if(atoi(argv[1]) < 3){          /* line 7 */ 
      printf("Got less then 3\n");  /* line 8 */ 
      if(atoi(argv[2]) > 5)         /* line 9 */ 
        c = 2;                      /* line 10 */ 
    }                               /* line 11 */ 
    else                            /* line 12 */ 
      printf("Got more then 3\n");  /* line 13 */ 
   exit(0);                         /* line 14 */ 
}                                   /* line 15 */


Example 2:  

main(argc, argv)                    /* line 1 */ 
int argc;                           /* line 2 */ 
char *argv[];                       /* line 3 */ 
{                                   /* line 4 */ 
  int c=0;                          /* line 5 */ 
  int a, b;                         /* line 6 */ 
                                    /* line 7 */ 
  a = atoi(argv[1]);                /* line 8 */ 
  b = atoi(argv[2]);                /* line 9 */ 
  if(a < 3){                        /* line 10 */ 
    printf("Got less then 3\n");    /* line 12 */ 
    if(b > 5)                       /* line 13 */ 
      c = 2;                        /* line 14 */ 
  }                                 /* line 15 */ 
  else                              /* line 16 */ 
    printf("Got more then 3\n");    /* line 17 */ 
 exit(0);                           /* line 18 */ 
}                                   /* line 19 */


Example 3:

int doublew(x) 
int x; 
{ return x*2; }

int triple( y) 
int y; 
{ return y*3; }

main() { 
  int i = 2; 
  printf("Got %d \n", doublew(i++)+ triple(i++)); 
}



Example 4:

int doublew(x) 
int x; 
{ return x*2; }

int triple( y) 
int y; 
{ return y*3; }

main() { 
  int i = 2; 
  int a, b;

  a = doublew(i++); 
  b = triple(i++);
  printf("Got %d \n", a+b); 
}





2


