Path: utzoo!attcan!uunet!mcsun!mcvax!hp4nl!targon!ruud From: ruud@targon.UUCP (Ruud Harmsen) Newsgroups: comp.lang.c Subject: Re: "do ... while ((NULL + 1) - 1);" -- valid C? Message-ID: <602@targon.UUCP> Date: 22 Aug 89 09:09:00 GMT References: <1043@levels.sait.edu.au> <961@virtech.UUCP> <10684@smoke.BRL.MIL> <940@lakesys.UUCP> <18996@mimsy.UUCP> <597@targon.UUCP> <781@janus.UUCP> Reply-To: ruud@targon.UUCP (Ruud Harmsen) Organization: Nixdorf Computer BV., DO, P.O. Box 29,Vianen, The Netherlands Lines: 12 In article <781@janus.UUCP> casper@fwi.uva.nl (Casper H.S. Dik) writes: >> The char-pointer gets its value from malloc, and I never change that char- >> pointer other than by adding multiples of sizeof(int) to it. Is a "ip = >> cp" guaranteed safe under these conditions, so can I ignore the compiler- >> warning? >No. It is not safe. If you ever want to run your program on a Data General >MV, among others, you should use "ip = (int *) cp". You're right, of course. As a matter of fact, I did use the cast in my program. Sorry I didn't mention that in the original article. Ruud Harmsen