Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!njin!princeton!idacrd!desj From: desj@idacrd.UUCP (David desJardins) Newsgroups: comp.lang.c Subject: Re: is this broken or what? Message-ID: <567@idacrd.UUCP> Date: 24 Jan 90 06:04:51 GMT References: <1482@mdbs.UUCP> Organization: idacrd, princeton, nj Lines: 24 From article <1482@mdbs.UUCP>, by wsmith@mdbs.UUCP (Bill Smith): > unsigned u = 0; > if (u-- < 4) > unsigned u = 0; > if(--u < 3) .... Can someone closely familiar with the ANSI standard tell us what are the allowable things which might happen when one decrements the unsigned value 0? Certainly there are many compilers which will assign a large positive value to the result, and so presumably the standard allows this. Can an ANSI-compliant compiler: (1) Assign some other new value (e.g., zero)? (2) Generate a run-time error? I would presume that both of these are legal responses, but I wouldn't mind hearing that from someone with more direct knowledge. As for the example code, I don't have any sympathy at all, although I do grudgingly admit that that particular optimization probably isn't a good idea. -- David desJardins