Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!gatech!mcnc!rti!xyzzy!throopw From: throopw@xyzzy.UUCP (Wayne A. Throop) Newsgroups: comp.lang.c Subject: Re: pointer cast question Message-ID: <280@xyzzy.UUCP> Date: Mon, 28-Sep-87 14:29:01 EDT Article-I.D.: xyzzy.280 Posted: Mon Sep 28 14:29:01 1987 Date-Received: Tue, 29-Sep-87 07:08:50 EDT References: <100@teletron.UUCP> <6449@brl-smoke.ARPA> <101@teletron.UUCP> Organization: Data General, RTP NC. Lines: 26 > andrew@teletron.UUCP (Andrew Scott) > I was just curious as to why > pointer casts exist if they basically do nothing. IF pointer casts did basically did nothing, THEN their existance might well be pointless. But they *DO* do something. They create a new value which has the format of a pointer of the cast type. On many machines, where all pointers have the same format, this does nothing. But the conceptual operation is still important, because there are machines where something must be done in such cases, such as casting from a short pointer type to a long one in some PC C implementations, or from character-granular pointer types to word-granular pointer types in some word-oriented machines. The cast operation doesn't guarantee the *alignment* of the result, but it does guarantee the *format* if the alignment already makes sense. -- Inigo hated it there. Everybody was so dangerous, big, mean and muscular, and so what if he was the greatest fencer in the world, who'd know it to look at him? He looked like a skinny Spanish guy it might be fun to rob. You couldn't walk around with a sign saying "Be careful, this is the greatest fencer since the death of the Wizard of Corsica. Do not burgle." --- From The Princess Bride by William Goldman -- Wayne Throop !mcnc!rti!xyzzy!throopw