Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!bellcore!faline!gtchen From: gtchen@faline.bellcore.com (George T. Chen) Newsgroups: comp.lang.c,comp.sys.mac Subject: Long integers Message-ID: <1380@faline.bellcore.com> Date: Fri, 11-Sep-87 09:38:59 EDT Article-I.D.: faline.1380 Posted: Fri Sep 11 09:38:59 1987 Date-Received: Sat, 12-Sep-87 17:35:56 EDT Reply-To: gtchen@faline.UUCP (George T. Chen) Organization: Bellcore MRE Lines: 43 Xref: mnetor comp.lang.c:4275 comp.sys.mac:6623 Has anyone had this problem? ... void get_value(size) long *size; { ...(do some processing)... printf("%ld",*size); } void routine() { ...(some declarations)... long size; ...(some other stuff).... get_value(&size); printf("%ld",size); } This routine dies on me! (Well not dies but doesn't work) For some reason, size is correct in the get_value routine, but seems to be int(size/256.)*256 in the calling routine. Almost as if the least significant byte became 0. However, if I now change routine to void routine() { ...(same declarations)... long garbage,size; ...(same other stuff).... get_value(&size); printf("%ld",size); garbage = 0; /* So that garbage is allocated memory instead */ /* of being ignored by the compiler */ } then everything works fine and dandy. What's going on? Someone told me it might be a problem with odd and even bytes, but I don't quite understand that. All help appreciated. -- +-----------------------------------------------------------------------------+ |What's a .signature? Life is an equation whose only solutions are irrational | |gtchen@thumper.bellcore.com ! gtchen@romeo.caltech.edu ! gtchen@where.am.i?. | +-----------------------------------------------------------------------------+