From: Kevin Ashley Newsgroups: comp.os.msdos.djgpp Subject: Re: Infinite loop??? Date: Mon, 13 Jul 1998 16:29:20 +0100 Organization: Posted via ULCC Internet Services Lines: 28 Message-ID: <35AA27D0.41C6@ulcc.ac.uk> References: <35A3D8C3 DOT 208E6D23 AT cyberdude DOT com> <35A5FC72 DOT C235F6D9 AT eik DOT bme DOT hu> <35A7A838 DOT 157A99A3 AT alcyone DOT com> <10o7uMA7JLq1EwoL AT foobar DOT co DOT uk> NNTP-Posting-Host: silver.ulcc.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Paul Shirley wrote: > > However I am unaware of any x86 (or 68K or MIPS) compiler that does not > perform arithmetic shifts (and I'm aware of enough apps that would fail > it this changed) so its a reasonable assumption to make. > > Presumably this is undefined to cope with some of the 'challenged' old > hardware out there incapable of efficient signed shifts. No, it could just as well be there because there were already two established conventions for what was the 'correct' behaviour when the ANSI standard came into force - but I confess I don't know. But your assumptions strike me as dangerous. I'm burnt often enough porting code that makes incorrect assumptions about the constancy of behaviour of C shift operators to never want to rely on them. This bug is is particularly problematic (to my mind at least) because it's difficult to spot from a cursory reading of the code whether or not it depends on the behaviour of the shift operators in undefined circumstances. Just because you find that the machines you deal with currently all behave the same way, sooner or later that assumption will return to bite you. ------------------------------------------------------------------------------ Kevin Ashley K DOT Ashley AT Ulcc DOT ac DOT uk Special Projects Manager http://www.ulcc.ac.uk/staff/Kevin+Ashley ULCC ...ukc!ncdlab!K.Ashley (but probably not any more) This is not a signature