When is a cast not a cast?

Jim Shankland jas at ernie.Berkeley.EDU
Sat May 20 05:08:48 AEST 1989


In article <2919 at buengc.BU.EDU> bph at buengc.bu.edu (Blair P. Houghton) writes:
>... a semanticist or a professional computer scientist ... neither
>of which I am.  I'm just a C-coding hacknut with a yen to see two pointers
>added together.

This much is abundantly clear.

You want to add two pointers together?  You can.  Here's how:

	char *cp1, *cp2, *cp3;
	...
	cp3 = (char *) ((unsigned long) cp1 + (unsigned long) cp2);

If you could do it a little less noisily than you have been :-(, many
of us would appreciate it.  Oh, and don't expect your code to be portable.
The above code has no meaning that is independent of a particular hardware
platform.  That's not C's fault, either.  If you don't understand why not,
then for Christ's sake, pick up a book or take a course or something.
Posting inane analogies and gratuitously insulting people who know more
about this than you do is a poor way to arrive at understanding.

Jim Shankland
jas at ernie.berkeley.edu

"Blame it on the lies that killed us, blame it on the truth that ran us down"



More information about the Comp.lang.c mailing list