When is a cast not a cast?

Doug Gwyn gwyn at smoke.BRL.MIL
Thu May 4 13:54:42 AEST 1989


In article <2759 at buengc.BU.EDU> bph at buengc.bu.edu (Blair P. Houghton) writes:
-In article <10191 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
->In article <2747 at buengc.BU.EDU> bph at buengc.bu.edu (Blair P. Houghton) writes:
->>10 	p = (c + (char *) i);  /* More trouble than it's worth... */
->Addition of pointers is a meaningless operation.
-Philosophically, it's rubbish.  According to the language def., it's pure
-science.

No, it's rubbish in any case.

-... but I find it more than
-unsettling that a pointer offset can not be expressed and manipulated
-directly in the pointer type.  At least, not without first multiplying or
-dividing by the proper sizeof(*type).

You're making things much harder than they really are.

	p = c + i;



More information about the Comp.lang.c mailing list