home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / atari / st / 11897 < prev    next >
Encoding:
Text File  |  1992-07-30  |  1.1 KB  |  37 lines

  1. Path: sparky!uunet!mcsun!sun4nl!dutrun!dutiws!boender
  2. From: boender@dutiws.tudelft.nl (P.Boender.TI-tel-4593)
  3. Newsgroups: comp.sys.atari.st
  4. Subject: Bug in Pure-C
  5. Message-ID: <1932@dutiws.tudelft.nl>
  6. Date: 30 Jul 92 19:37:08 GMT
  7. Organization: Delft University of Technology,The Netherlands
  8. Lines: 27
  9.  
  10. Hi,
  11. With a friend of mine, I discovered a bug in Pure-C.
  12. In some circumstances, variables that are declared static in a source
  13. file (outside of any function) and that are only used in one function,
  14. do not actually exist outside of that function. Unless: they are initialised
  15. to a value, or the option "Do not use register variables" is set.
  16.  
  17. example:
  18. #include<many files>
  19.  
  20. static int desk_x, desk_y, desk_w, desk_h;
  21.  
  22. void window_init(void)
  23. {
  24. .....
  25.    handle = wind_get(0, WF_WORKXYWH, &desk_x, &desk_y, &desk_w, &desk_h);
  26. .....
  27. }
  28.  
  29. Doesn't work unless option "do not use register variables" is set.
  30. Changing the variables to:
  31. static int desk_x = 0, desk_y = 0, desk_w = 0, desk_h = 0;
  32. also makes it work.
  33. This is Pure-C of sept. 20, 1991.
  34. Has anyone seen this bug before, or does anyone know of workarounds?
  35. Many thanks,
  36.   P. Boender
  37.