Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!utcsri!flaps From: flaps@utcsri.UUCP Newsgroups: comp.lang.c Subject: Re: Silly program [was Re: Style [++i vs i++] ] Message-ID: <5272@utcsri.UUCP> Date: Tue, 18-Aug-87 23:14:39 EDT Article-I.D.: utcsri.5272 Posted: Tue Aug 18 23:14:39 1987 Date-Received: Thu, 20-Aug-87 04:36:58 EDT References: <8298@brl-adm.ARPA> <587@cblpe.ATT.COM> <189@xyzzy.UUCP> <513@ivax.doc.ic.ac.uk> Reply-To: flaps@utcsri.UUCP (Alan J Rosenthal) Organization: University of Toronto Lines: 26 Summary: In article <513@ivax.doc.ic.ac.uk> dcw@doc.ic.ac.uk (Duncan C White) writes: >I think Alan is wrong here: if he really wants to add one byte, ^^^^ (not me!) >[well, one char] to something that is a 'pointer to [int]' >then I guess he should use: > > p = (int *) ( 1 + (char *) p ); ...except that when you dereference it you will get an address exception! Come on here, it is MEANINGLESS to do this kind of operation. It's not just that "adding sizeof(int)" is what you probably want, it's that it's the only sensible thing to do. Now, if you keep the result as char *, that's a different story (as in the code for memcpy()). -- // Alan J Rosenthal // \\ // flaps@csri.toronto.edu, {seismo!utai or utzoo}!utcsri!flaps, \// flaps@toronto on csnet, flaps at utorgpu on bitnet. "To be whole is to be part; true voyage is return."