Path: utzoo!attcan!uunet!mcvax!hp4nl!tnosoes!tom From: tom@tnosoes.UUCP (Tom Vijlbrief) Newsgroups: comp.lang.c++ Subject: Re: references and casts Message-ID: <433@tnosoes.UUCP> Date: 26 Jan 89 09:56:00 GMT References: <26414@teknowledge-vaxc.ARPA> Organization: TNO Institute for Perception, Soesterberg, The Netherlands Lines: 36 mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes: >I have the following program: Lines deleted... > sym foo = THIRD; > int far = 0; > int& boo = (int) foo; > int& bar = far; >I expected "foo = 1, boo = 1". Do I misunderstand how references >work? The declaration: int& boo = (int) foo; will NOT declare boo to reference variable foo. "boo" will reference a integer valued expression. It is as if you had written: int xtemp= (int) foo; int& boo= xtemp; Changing foo will not change boo. Tom =============================================================================== Tom Vijlbrief TNO Institute for Perception P.O. Box 23 Phone: +31 34 63 62 77 3769 ZG Soesterberg E-mail: tnosoes!tom@mcvax.cwi.nl The Netherlands or: uunet!mcvax!tnosoes!tom ===============================================================================