Jump to content
Sign in to follow this  
Stringer

Too many nested calls

Recommended Posts

Nevermind, I found answer by searching the board. So theres only 8 levels.. Is there way to say for compiler that "hey! when I call this function X at line 1024, do it inline." ?

Share this post


Link to post
Share on other sites
Guest Pavel
Is there way to say for compiler that "hey! when I call this function X at line 1024, do it inline." ?

Compiler does stack check when code is already being converted to assembly and knowledge about C code is partially lost. It should be possible but is not trivial.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

I guess one way to do that would be even before assembler.

 

For example, if I had function like following:

 

char Test(char Param)
{
  char Temp;

  Temp = Param;

  return Temp;
}

 

And I wanted to call it inline like following (notice the word inline):

 

char Test2(char Param)
{
  char Temp;

  inline Temp = Test( Param );

  return Temp;
}

 

The preprocessor would turn the function Test2 to look something like this:

 

char Test2(char Param)
{
  //Compiler generated variables
  char _Test_Param_Param_00;
  char _Test_Local_Temp_00;

  //Original variables
  char Temp;
  
  //Inline conversion for function Test
  //Parameter init
  _Test_Param_Param = Param;
  //Function body
  _Test_Local_Temp = _Test_Param_Param;
  //Function deconstructor
  Temp = _Test_Local_Temp;

  return Temp;
}

 

 

Not pretty, but I guess it could work and might be easy to do (?). Afterall, this kind functionality is mainly needed for functions like LCD_Enable();

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...