TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Peter Collis
date: 1996-05-16 11:27:52
subject: indirection

-= Pete Replied to Paul Edwards about: indirection =-

G'day Paul

 PE> int *x;
 PE> int y;

 PE> y = 3 * x;

this one generates the error C2121 "bad right operand"
and the warning C4047 "different levels of indirection"

 PE> y = * x;

 PE> y = *x;

These two compile without error with QC25 so i assume the space is
ignored as y is assigned the same value in both cases (whatever *a
points to) btw i added 'int z; x = &z; *x = 9;' after to test if y was
being assigned the same value in both cases 'example 2 & 3', it was.

 PE> Which ones do you reckon are legal?  I am wondering how mulitplication
 PE> and indirection are distinguished between.  Is the space significant?

Examples 2 & 3 seem legal so the space doesn't seem significant as in
both cases y is assigned what x points to, if example 1 is changed to
'y = 3 * *x;' or 'y = **x;' the result is 27 in both cases assuming
that "*x = 9 as i stated above" so again the space is ignored and x is
not misinterpreted as a pointer to a pointer. I'd say multiplication
and indirection are distinguished by the type of variable the result
is applied to.

   -=Pete=-

--- OMX/Blue Wave v2.12
* Origin: Gates of Hell (3:713/914.16)
SEEN-BY: 50/99 620/243 623/630 711/401 409 410 413 430 808 932 934 712/508
SEEN-BY: 712/515 713/111 317 601 611 615 618 700 826 888 914 714/906 800/1
@PATH: 713/914 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™.