Mail Archives: djgpp/1997/10/15/08:15:24
Egg brains wrote:
>
> okay, i hate to ask question in here... (it's only rarely that i can ever
> answer questions and there fore i feel like someones pulling me around)
>
> anyway, i got stuck (for the last 2 days now)
>
> when i try:
>
> long foo;
> foo=800;
> cout << &foo;
>
> it only print's "1"... how come? shouldn't it print the referenec of foo? and
> when i try to put it in a varible first such as
That's a bug in the iostream library. Search the mail archive for a
recent discussion. Or even better, port the new version to DJGPP
(just kidding)
The workaround is what you did below, maybe with a leading
<< hex()
before the variable.
>
> long foo;
> foo=800;
> long stuck=(long)&foo;
> cout << stuck;
>
> it prints a number other than one, but when i run the program again and again,
> the number stay's the same. when i swtich around the loading order for the
> varible the number stays the same as well..
Probably it's a local var, so the location on the stack should remain
the same within runs. Even if it were global, depending on your system
environment, it is pretty likely to occupy always the same location
in memory. So this is not worrying.
--
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
- Raw text -