piclist 2002\02\25\165249a >
Thread: is it ok to have stack underflow ?
www.piclist.com/techref/microchip/devices.htm?key=pic
picon face BY : wouter van ooijen & floortje hanneman email (remove spam text)



> In my 16F628 program I call a subroutine that waits for an event to
happen.
> If the event does not happen within a certain length of time can I use a
> goto instruction to restart the program from a known point, without using
a
> return instruction to pop the return address back off the stack ?
> I know this will cause a stack underflow(?) condition, but since the stack
> is a circular buffer surely it won't matter because subsequent calls will
> have the required return to go with them - or will it ?

Stack overflow is never a problem, it is the stack underflow (that in most
cases unavoidably follows a stack overflow) that is the problem. But what
you describe is one of the specialised uses of stack overflow that does not
cause a later underflow (because you skip a return), so this use ie
perfectly OK.

Wouter van Ooijen
--
Van Ooijen Technische Informatica: http://www.voti.nl
Jal compiler, Wisp programmer, WLoader bootloader, PICs kopen

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspammitvma.mit.edu


<065c01c1bdf4$acdcb5a0$0500a8c0@home> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) is it ok to have stack underflow ?

month overview.

new search...