jjk@jupiter.astro.umd.edu (Jim Klavetter) (03/29/91)
> >Are you sure they are all ints? If one of either a or b or c is really >an UNSIGNED int, then a-b-c would be some big positive number, which >would explain the first example. If temp is an int, then putting that >big positive integer back in temp would do what you want, since temp >would then have the value -1. >================== >Chris Volpe Thanks to Chris and the others who e-mailed me, this was indeed the case. I took the original expression and added a cast to make all types "int" and it worked as expected. According to PROGRAMMING IN ANSI C by Kochan, there are 6 rules for data type conversions. Unfortunately, nowhere in those rules does the question of int vs unsigned (int) enter. Upon reflection, I think this is a mistake, or at least shortcoming, of this text. Does K&R2 explicitely mention this? Also, can someone post or send the full set of conversion rules? I would like to know exactly what I was comparing. Thanks again. jjk@astro.umd.edu also for Athabasca and Reudi Jim Klavetter Astronomy UMD College Park, MD 20742