TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: Paul Edwards
date: 1996-05-17 03:15:32
subject: indirection

FA> -=> Quoting Paul Edwards to All <=-
PE> int *x;
PE> int y;
PE> y = 3 * x;
PE> y = * x;
PE> y = *x;
PE> Which ones do you reckon are legal?  I am wondering how mulitplication
PE> and indirection are distinguished between.  Is the space significant?

FA> Paul, i am shocked ! Pointers can't be multiplied !?

I wasn't actually aware that they couldn't be multiplied.  But
I suppose with all the warnings I've seen about suspicious 
pointer conversion, which was a pointer being used as an integer
somewhere, that maybe it can't be used as an integer after all.
I am used to pointers being integers, and knowing how C likes to
let you do anything, I would have thought you could do something
like that!  

Come to think of it, I think I remember something about pointers
not being allowed to be divided either.  But there is certainly
a reason to want to do that.

E.g.

char *start;
char *end;
char *middle;

middle = (start + end) / 2;

I think I remember reading that you had to go:

middle = start + (end - start) / 2;

BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.