home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18877 < prev    next >
Encoding:
Text File  |  1993-01-09  |  988 b   |  37 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!demos!news-server
  3. From:  michael@ovsen.msk.su (Michael Y. McAlcin)
  4. Subject: Re: Static global initialization outside of main() legal?
  5. References: <34727@sales.GBA.NYU.EDU>
  6. Date: Sat, 9 Jan 1993 15:05:10 GMT
  7. Reply-To: michael@ovsen.msk.su
  8. Organization: Ovsen Ltd.
  9. Sender: news-server@kremvax.hq.demos.su
  10. Message-ID: <AAcckJhC92@ovsen.msk.su>
  11. Lines: 24
  12.  
  13. In comp.lang.c++ in <34727@sales.GBA.NYU.EDU>
  14. wlee@sales.GBA.NYU.EDU (Wai-Shing Lee) writes:
  15.  
  16. >
  17. >static int *pointer ;
  18. >static int initialized=findvideomemory() ;
  19. >
  20. >static int makepointer(void)
  21. >{
  22. >       pointer=(int*)calloc(10, sizeof(char)) ;
  23. >}
  24. >
  25. >I've traced it and sure enough makepointer() is called and pointer is assigned
  26. >a value before main() even starts.  Is the portable, legal.  I didn't look
  27. >to hard in my C++ book, but there weren't any obvious answers.  Is this
  28. >C++, C or something I should stay away from?
  29. >
  30.  
  31. See ARM 8.4
  32.  
  33. Michael Y. McAlcin
  34. Ovsen Group Ltd. of Russia
  35.  
  36.  
  37.