Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsh!rkl From: rkl@cbnewsh.att.com (kevin.laux) Newsgroups: comp.os.msdos.programmer Subject: Re: using int's in C Message-ID: <1991Mar25.142320.24275@cbnewsh.att.com> Date: 25 Mar 91 14:23:20 GMT References: <1991Mar23.021231.21131@grebyn.com> <1991Mar25.005251.12943@grebyn.com> Distribution: na Organization: AT&T Bell Laboratories Lines: 31 In article <1991Mar25.005251.12943@grebyn.com>, jmbj@grebyn.com (Jim Bittman) writes: > I'm kind of embarrassed to point out that the *entire* problem was due > to not turning off run-time stack checking. I can use the exact same > code as Borland, but compile with /Gs, and it works! > > But: > - Why isn't outp (MicroSoft) a "nice" function? > - We checked the MS documentation and several other books, but > nothing mentioned the /Gs switch (in relation to HW ints), > any reasons why? The outp () function is a nice function. *Any* function with arguments could have caused the stack problem because arguments are (normally, except for fastcall) pushed onto the stack. Interrupts occur asynchronously and the ISR gets whatever stack is in effect. When you use the interrupt keyword all the registers are pushed onto the current stack and it's up to the ISR to provide it's own stack if necessary. It's not a failing (per se) on the MSC documentation, because writing an ISR is an advanced topic dealing with the system and not any particular C compiler. Actually, getting caught with the run-time stack checking is a fairly common occurence when writing ISR's; common enough that MS should say a few words about it in their Advanced Programming Techniques manual. Alas, stuff like this tends to fall into the cracks and one has to find out the hard way. :-( -- ________________________________________________________________________________ R. Kevin Laux Email: rkl1@hound.att.com AT&T Bell Labs Voice: (908) 949-1160 Holmdel, NJ 07733 Fax: (908) 949-0959