Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* Problem with variable type and compiler
@ 1996-08-09  4:00 Rajeev Kumar Ranjan
  0 siblings, 0 replies; only message in thread
From: Rajeev Kumar Ranjan @ 1996-08-09  4:00 UTC (permalink / 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
-----------------------------------------------------



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-08-09  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-08-09  4:00 Problem with variable type and compiler Rajeev Kumar Ranjan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox