From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,1f7988fe69a3fda1,start X-Google-Attributes: gidfee84,public X-Google-Thread: f678f,1f7988fe69a3fda1,start X-Google-Attributes: gidf678f,public From: rajeev@deep.EECS.Berkeley.EDU (Rajeev Kumar Ranjan) Subject: Problem with variable type and compiler Date: 1996/08/09 Message-ID: #1/1 X-Deja-AN: 173193493 sender: rajeev@deep.EECS.Berkeley.EDU organization: University of California, Berkeley newsgroups: comp.unix.osf.osf1,comp.unix.osf.misc #include /* ** Comments: ** The following simple program has different behavior for different ** compilers and variable types. Could somebody explain? I ran the ** experiments on DEC Alpha, running OSF. ** ** Type of j Type of k Program terminates? ** (with cc) (with gcc) ** int/short int/short Y Y ** unsigned int int/short N N ** unsigned short int/short N Y <----- mismatch ** short/int unsigned short/int N N ** unsigned short/int unsigned short/int N N ** ** Bottomline: I understand the first, fourth, and fifth case. But ** can somebody throw light on 2nd and 3rd case? ** Thanks. */ main() { int k; unsigned short j = 0; for (k=5; k >= j; k--); } -- ------------------------------------------------------ Rajeev K. Ranjan internet address: rajeev@eecs.berkeley.edu URL: http://www-cad.eecs.berkeley.edu/~rajeev phone no: 510-642-3234 Department of EECS, University of California, Berkeley -----------------------------------------------------