home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!dutrun!dutiws!boender
- From: boender@dutiws.tudelft.nl (P.Boender.TI-tel-4593)
- Newsgroups: comp.sys.atari.st
- Subject: Bug in Pure-C
- Message-ID: <1932@dutiws.tudelft.nl>
- Date: 30 Jul 92 19:37:08 GMT
- Organization: Delft University of Technology,The Netherlands
- Lines: 27
-
- Hi,
- With a friend of mine, I discovered a bug in Pure-C.
- In some circumstances, variables that are declared static in a source
- file (outside of any function) and that are only used in one function,
- do not actually exist outside of that function. Unless: they are initialised
- to a value, or the option "Do not use register variables" is set.
-
- example:
- #include<many files>
-
- static int desk_x, desk_y, desk_w, desk_h;
-
- void window_init(void)
- {
- .....
- handle = wind_get(0, WF_WORKXYWH, &desk_x, &desk_y, &desk_w, &desk_h);
- .....
- }
-
- Doesn't work unless option "do not use register variables" is set.
- Changing the variables to:
- static int desk_x = 0, desk_y = 0, desk_w = 0, desk_h = 0;
- also makes it work.
- This is Pure-C of sept. 20, 1991.
- Has anyone seen this bug before, or does anyone know of workarounds?
- Many thanks,
- P. Boender
-