Jump to content
Sign in to follow this  
Stringer

Loop bug with C++

Recommended Posts

Try following:

 

class TEST
{
public:
  char TestThis();
  void WithThis();
};

char TEST::TestThis()
{
  return 10;
}

void TEST::WithThis()
{
  while(TestThis() != 10 );
}

 

It should produce "Undefined identifier 'TestThis'" -error from the compiler.

Share this post


Link to post
Share on other sites
Guest Pavel

Will look into this. A workaround is to use the 'for' loop:

char i;
 for( i = TestThis(); i != 10; i = TestThis() );

Regards,

Pavel

Share this post


Link to post
Share on other sites

Probably related to this issue, it looks like the compiler sometimes forgets to insert proper symbol defination to the assembler file for local variables in the returning functions. For example, following line were missing:

 

_temp_Read                      equ 0x5e;1

 

Its still little unclear to me, why it doesn't insert that anymore. However, this is what I did before the problem:

 

1. I added one public variable to the class

2. I added a "if variable != 1" to one of my methods. The method (WaitUntilNotBusy) has a callback to another method with char returning (mehod Read).

3. lastly I added a callback to WaitUntilNotBusy in a third method (write_instruction)

 

It does seem to have no effect if the Read function is global or in the class.

 

 

The code is partially from the LCD example, in a class.

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...