Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: pointer arithmetic question Message-ID: <6580@brl-smoke.ARPA> Date: Mon, 19-Oct-87 08:39:24 EDT Article-I.D.: brl-smok.6580 Posted: Mon Oct 19 08:39:24 1987 Date-Received: Tue, 20-Oct-87 02:07:00 EDT References: <0.21787448@milehi> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 8 In article <0.21787448@milehi> Ray_Gardner@milehi (Ray Gardner) writes: >I cured the problem with a cast: > ((long)(p1 - p->buf) + p->fpos) + 101 The compiler should have done essentially this for you in the first place. The difference of two pointers within the same aggregate object is some signed integral type; when that is added to a (long), it should have been converted to (long) before the addition.