Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!alberta!ers!teletron!andrew From: andrew@teletron.UUCP (Andrew Scott) Newsgroups: comp.lang.c Subject: Re: pointer cast question Message-ID: <101@teletron.UUCP> Date: Mon, 21-Sep-87 14:25:02 EDT Article-I.D.: teletron.101 Posted: Mon Sep 21 14:25:02 1987 Date-Received: Wed, 23-Sep-87 04:40:31 EDT References: <100@teletron.UUCP> <6449@brl-smoke.ARPA> Organization: TeleTronic Communications Ltd., Edmonton, Alta. Lines: 20 Keywords: pointer cast alignment In article <6449@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes: > > Generally, you should not attempt to play tricks with pointer casts > (other than on the result of malloc() and the argument to free()) > until you're quite familiar with C. If you declare types correctly, > such casts are seldom necessary, and they're almost always associated > with non-portable code. (There are a few exceptions.) Actually, this whole question came up because I am writing a form of malloc() for a target operating system, obviously unportable. I ended up performing the necessary alignment myself, but I was just curious as to why pointer casts exist if they basically do nothing. On a (sort of) related question, one I am sure has been brought up before, is there a way to make lint shut up about "possible pointer alignment" problems when one is sure there are no problems (such as casting the return value of malloc() )? Our documentation does not mention any kind of comment (like /* VARARGS */) which would do the trick. Andrew