TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Michael Stapleton
date: 1996-05-18 22:03:00
subject: Re: indirection

-=> Quoting Paul Edwards to Frank Adam <=-

 Hello Paul,

PE> I am wondering how mulitplication and indirection are
PE> distinguished between.  Is the space significant?

I don't see how they can get confused, since multiplication is
dyadic & indirection is monadic, with higher precedence.  I've never
seen a legal C expression that was ambiguous with respect to these
operators.  FWIW, the space is not significant.

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

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

No, pointers are integers, but their arithmetic is restricted.  Let
me quote from K&R2, p.103.

"The valid pointer operations are assignment of pointers of the same
type, adding or subtracting a pointer and an integer, subtracting or
comparing two pointers to members of the same array, and assigning
or comparing to zero.  All other pointer arithmetic is illegal.  It
is not legal to add two pointers, or to multiply or divide or shift
or mask them, or to add float or double to them, or even, except for
void *, to assign a pointer of one type to a pointer of another type
without a cast."

Michael Stapleton of Graphic Bits.

 * AmyBW v2.10 *
... In C, the solution probably has to do with asterisks or something.
--- Blue Wave/RA v2.10 AmyBW
* Origin: The Three Amigas - better than two (3:713/615.0)
SEEN-BY: 50/99 620/243 623/630 711/401 409 410 413 430 808 809 932 934
SEEN-BY: 712/508 515 713/111 317 601 611 615 618 700 826 888 914 714/906
SEEN-BY: 800/1
@PATH: 713/615 888 711/808 934

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™.