> -----Original Message-----
> From:
spamBeGonepiclist-bouncesspamBeGone
mit.edu [
TakeThisOuTpiclist-bouncesEraseME
spam_OUTmit.edu] On Behalf
> Of Michael Dipperstein
> Sent: Thursday, February 23, 2006 7:45 PM
> To: Microcontroller discussion list - Public.
> Subject: RE: [PIC] 2 questions about 18f4550.
>
> > It does not need a return.
> > You are indeed correct. That is my entire point.
> >
> > But, how does the compiler know that? How does it know that it can
> > appropriately not generate any entrance and exit code? Because you
> > wrote the function like that? What if that is an error and you would
> > have wanted a warning about 'non reachable code' or 'function does not
> > exit'. Sure in a non multitasking word that is sometimes 'just one
> > function'. In a multi-tasking world it is not. Quite a few times
> I've
> > stumbled across applications - such as the slot machine I am working
> on
> > now - that has quite a few layers of functions called before you even
> > get into the one that has the endless loop. This is a PIC list but
> the
> > issue is relevant more to non PIC chips in this case.
>
> I've seen this handled two ways:
> 1) Issue a warning and generate non-returning code anyway
> 2) Include a special directive for the compiler
>
> I just started working with IAR C for the AVR and it uses approach #2.
> If I remember right they have two ways of dealing with it. An ANSI
> compliant #pragma and an extended __noreturn modifer.
>
> -Mike