From owner-freebsd-questions Wed Jan 18 10:59:48 1995 Return-Path: questions-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id KAA11763 for questions-outgoing; Wed, 18 Jan 1995 10:59:48 -0800 Received: from sovcom.kiae.su (sovcom.kiae.su [144.206.136.1]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id KAA11755; Wed, 18 Jan 1995 10:59:42 -0800 Received: by sovcom.kiae.su id AA20951 (5.65.kiae-2 ); Wed, 18 Jan 1995 21:58:45 +0300 Received: by sovcom.KIAE.su (UUMAIL/2.0); Wed, 18 Jan 95 21:58:44 +0300 Received: (from ache@localhost) by astral.msk.su (8.6.8/8.6.6) id VAA00542; Wed, 18 Jan 1995 21:55:59 +0300 To: freebsd-current@freefall.cdrom.com, freebsd-questions@freefall.cdrom.com, "Ugen J.S.Antsilevich" References: In-Reply-To: ; from "Ugen J.S.Antsilevich" at Wed, 18 Jan 95 20:01:30 IST Message-Id: Organization: Olahm Ha-Yetzirah Date: Wed, 18 Jan 1995 21:55:59 +0300 X-Mailer: Mail/@ [v2.31 FreeBSD] From: "Andrew A. Chernov, Black Mage" X-Class: Fast Subject: Re: GCC bug again... Lines: 25 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Length: 1020 Sender: questions-owner@FreeBSD.org Precedence: bulk In message Ugen J.S.Antsilevich writes: >As you guys completely missed the point of what the bug is >(probably it was my fault- i wrote too long and unclear mail) >i repeat it in constructive way: >1) After those 2 types of lseek file pointer is set to wrong location. > lseek(f,-sizeof(buf),SEEK_CUR) <--this is withno cast but must hold > lseek(f,(off_t)-sizeof(buf),SEEK_CUR) <--this one has *RIGHT* cast >2) This one works and sets pointer to right location. > lseek(f,(int)-sizeof(buf),SEEK_CUR) <--but the cast is completely wrong! >That's the bug,now what would you say? Sizeof is unsigned type, so -unsigned undefined. Right casts is: -((off_t)sizeof(buf)) -- Andrew A. Chernov : And I rest so composedly, /Now, in my bed, ache@astral.msk.su : That any beholder /Might fancy me dead - FidoNet: 2:5020/230.3 : Might start at beholding me, /Thinking me dead. RELCOM Team,FreeBSD Team : E.A.Poe From "For Annie" 1849