Path: utzoo!utgpu!watserv1!ria!uwovax.uwo.ca!7103_2622 From: 7103_2622@uwovax.uwo.ca (Eric Smith) Newsgroups: comp.sys.atari.st.tech Subject: Re: bug in GNU library Message-ID: <1991Apr1.213235.8915@uwovax.uwo.ca> Date: 2 Apr 91 02:32:35 GMT References: <1991Mar27.152726.8444@doe.utoronto.ca> <1991Mar28.194823.2209@netcom.COM> Lines: 35 >>> I've found a bug (or at least an unintuitive feature :-) ) in the >>> library supplied with GNU C 1.37.1 found on atari.archive. When I >>> make a call to stat(), after the call, the address returned by >>> Fgetdta() is different than it was before the call. Is this a bug? >>> If so, why would it be desirable for stat() to have this side-effect? > I would argue that the stat() and all other such functions should have > an Fgetdta() in the 1st line of their code and an Fsetdta() in the > last. That is just good practice. > You're quite correct. Actually, in the latest version of the GCC library this *is* done, except that the function returns prematurely if the file is not found (i.e. the DTA pointer is messed up if you do a stat() on a file that doesn't exist). The MiNT library also has this bug at patchlevel 7; it (and lots of other bugs) are fixed in patchlevel 8, which is now available at atari.archive. >>In general, you might want to switch to Eric Smith's MiNT library. It >>is an update and improvement on the standard GCC library, and is >>also available on atari.archive. > > Yes, but you need MiNT to run a program compiled with that library, > correct? If not, that is definitely a win-win situation! > No, not correct. The library works under TOS, except that some functions that are MiNT specific (e.g. fork, pipe, spawnve(P_NOWAIT,...)) will fail -- if you avoid those kinds of functions, e.g. by writing standard ANSI C, then your program will work fine under either TOS or MiNT. (NetHack 3.0j was compiled with the MiNT library, for example, and that certainly exercises a lot of functions!) -- Eric R. Smith email: Dept. of Mathematics eric.smith@uwo.ca University of Western Ontario 7103_2622@uwovax.bitnet