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 / tests2.2 / arbints.c next >
Text File  |  1997-09-03  |  721b  |  35 lines

  1. typedef /*@integraltype@*/ a_int;
  2. typedef /*@unsignedintegraltype@*/ u_int;
  3. typedef /*@signedintegraltype@*/ s_int;
  4.  
  5. int f (a_int a, u_int u, s_int s)
  6. {
  7.   unsigned long ul;
  8.   long l;
  9.   
  10.   printf ("the values are: %d %ld %ud", a, u, s); /* expect 3 errors */
  11.   ul = a; /* Assignment of a_int to unsigned long int: ul = a */
  12.  
  13.   /*@+longunsignedintegral@*/
  14.   ul = a;
  15.  
  16.   /*@+longintegral@*/
  17.   ul = a;
  18.  
  19.   if (u == a) printf ("yo!");
  20.  
  21.   /*@+matchanyintegral@*/
  22.   if (u == l) printf ("yo!");
  23.   if (u == a) printf ("yo!");
  24.   /*@=matchanyintegral@*/
  25.  
  26.   /*@+longsignedintegral@*/
  27.   printf ("i'm okay: %ld", s);
  28.  
  29.   /*@+longunsignedunsignedintegral@*/
  30.   printf ("you're not! %ld", u);
  31.   printf ("you're not! %ud", u);
  32.  
  33.   return a;
  34. }
  35.