Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jan 1995 21:55:59 +0300
From:      "Andrew A. Chernov, Black Mage" <ache@astral.msk.su>
To:        freebsd-current@freefall.cdrom.com, freebsd-questions@freefall.cdrom.com, "Ugen J.S.Antsilevich" <ugen@netvision.net.il>
Subject:   Re: GCC bug again...
Message-ID:  <UB_GM7l4U1@astral.msk.su>
In-Reply-To: <Chameleon.950118200622.ugen@ugen.NetManage.co.il>; from "Ugen J.S.Antsilevich" at Wed, 18 Jan 95 20:01:30 IST
References:  <Chameleon.950118200622.ugen@ugen.NetManage.co.il>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <Chameleon.950118200622.ugen@ugen.NetManage.co.il> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?UB_GM7l4U1>