Date: Sat, 26 Nov 94 13:40:38 +0100 From: sl051ma AT unidui DOT uni-duisburg DOT de (Michael Mauch) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: -1441992/4 = 1073381326 Hi Kimberley! On 25 Nov 94, OKRA AT max DOT tiac DOT net wrote: > This program: > > int main() { > > long x = -1441992; > unsigned y = 4; > > printf("%d / %d = %d\n",x,y,x/y); > } > > Spits this out: > > -1441992 / 4 = 1073381326 It works fine, if you use a cast: printf("%d / %d = %d\n",x,y,x/(long)y) I don't know, if this is a bug or a feature (of ANSI-C). But it's nice, that gcc does not necessarily need a "%ld" for the long values. Bye... Michael