home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lclint.zip / lclint-2_3h-os2-bin.zip / test / abstptr.c < prev    next >
Text File  |  1997-09-03  |  790b  |  25 lines

  1. typedef int *abst;
  2.  
  3. /*@noaccess abst*/
  4. int main (void)
  5. {
  6.   abst a;
  7.   int b = 3;
  8.   abst *ap = (abst *) NULL;
  9.   abst *ap2 = NULL;
  10.   void *vp;
  11.   int *ip;
  12.  
  13.   vp = ap ; /* 1. Assignment of abst * to void *: vp = ap */
  14.   ip = ap2; /* 2. Assignment of abst * to int *: ip = ap2 */
  15.   ap = ip ; /* 3. Assignment of int * to abst *: ap = ip */
  16.   vp = (void *) ap ; /* 4. Cast from underlying abstract type abst *: (void *)ap */
  17.   a = *ap ; /* 5. Possible dereference of null pointer: *ap */    
  18.   *ap = a ;
  19.   vp = (void *)&a ; /* 6. Cast from underlying abstract type abst *: (void *)&a */
  20.   ap = (abst *)&b ; /* 7. Cast to underlying abstract type abst *: (abst *)&b */
  21.   ap = &b; /* 8. Assignment of int * to abst *: ap = &b */
  22.   *ap = b; /* 9. Assignment of int to abst: *ap = b */
  23.   return 12;
  24. }
  25.