recursion

Discuss about beta versions of mikroC compiler.
Post Reply
Author
Message
bruno
Posts: 767
Joined: 10 Sep 2005 02:10
Location: Lyon, France
Contact:

recursion

#1 Post by bruno » 25 Apr 2006 17:52

Hello,

tell me if I'm wrong or not, but it seems to me that recursion with limited depth is allowed with dspic devices

then this code :

Code: Select all

float ex ;

float expo(float f, int n)
      {
      float e ;
      
      if(n == 1) return(f) ;
      e = expo(f, --n) ;
      return(e * f) ;
      }
      
main()
      {
      ex = expo(2.0, 2) ;
      }
should be ok isnt'it ?

but running it in watch window, I get an "Inaccessible" value for the local variables (this may be ok) but the return value of the function is not correct : 0 instead of 4

Image

Thanks,

Bruno

User avatar
rajkovic
mikroElektronika team
Posts: 694
Joined: 16 Aug 2004 12:40

Re: recursion

#2 Post by rajkovic » 26 Apr 2006 09:17

bruno wrote:Hello,

tell me if I'm wrong or not, but it seems to me that recursion with limited depth is allowed with dspic devices

Thanks,

Bruno
Recursion is limited only by RAM of specific device.
Bug is fixed we will probably have new version today or tommorow.

Post Reply

Return to “mikroC Beta testing”