home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / c / 13525 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  917 b 

  1. Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!wirzeniu
  2. From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Address of static variables??
  5. Keywords: static variables
  6. Message-ID: <1992Sep11.132917.2038@klaava.Helsinki.FI>
  7. Date: 11 Sep 92 13:29:17 GMT
  8. References: <1992Sep11.115912.9604@hippo.ru.ac.za>
  9. Organization: University of Helsinki
  10. Lines: 15
  11.  
  12. ifkm@hippo.ru.ac.za (Andrew Murdoch) writes:
  13. >Is the static variable some_string always guaranteed to have
  14. >the same address?  
  15.  
  16. During one execution of the program, yes.
  17.  
  18. >That is, will a_pointer always be a valid
  19. >pointer?  Of course some_function would have to be called first.
  20.  
  21. As long as it points into the static variable in question, yes.  It can
  22. naturally become invalid if you change it, but that depends on how you
  23. change it ("a_pointer = (char*)1;" will most probably make it invalid).
  24.  
  25. --
  26. Lars.Wirzenius@helsinki.fi
  27.