From: rajeev@deep.EECS.Berkeley.EDU (Rajeev Kumar Ranjan)
Subject: Problem with variable type and compiler
Date: 1996/08/09 [thread overview]
Message-ID: <utfpw50tk25.fsf@deep.EECS.Berkeley.EDU> (raw)
#include <stdio.h>
/*
** 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
-----------------------------------------------------
reply other threads:[~1996-08-09 4:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox