Jump to content
Sign in to follow this  
fransp

Not Realy A Bug

Recommended Posts

Hi Pavel,Dave.

 

Compiler BoostC.

 

Just coming from another language and am still fighting the C barrier. :)

So if it is not done 'right' so please forgive me.

My oppinion:

Knowing why and how a compiler works allows you to write better code.

 

That is why I did the following test.

 

volatile bit LED1;

volatile bit LED2;

LED1 = LED1;

LED1 = LED2;

LED1 = !LED1;

LED1 = !LED2;

 

Frist two assignments are compiling to a double bittest and skip. Ok, that is what I would do in asm.

The first assigment should have been optimized out?

 

For the third you cannot use this double bittest and skip, because you make changes to what you have to test. So an intermediar is ok.

But in essence this intermediar is not needed in the fourth assignment.

Here you can use the bittest and skip with set and clear interchanged.

 

Am I overlooking something.

 

Do I have to post this kind of remarks:

in another section?

never again?

 

 

Wiht best regards,

 

 

Frans.

Share this post


Link to post
Share on other sites

Well this looks more like an enhancement request. Anyway code for 'LED1 = !LED2' has been optimized for both volatile and non-volatile operands. Will be available in the next release.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
Well this looks more like an enhancement request. Anyway code for  'LED1 = !LED2' has been optimized for both volatile and non-volatile operands. Will be available in the next release.

 

Regards,

Pavel

 

Hi Pavel.

 

Thanks for the quick repy.

 

But there is something important thing left out.

 

The double bittest and skip method does not work on a variable which is source and destination

So you have to treat

 

LED1 = !LED1

 

differently form

 

LED1=!LED2

 

 

Because if source and destination are the same then halfway the code you are changing the source you are not still finished with.

 

With best regards.

 

 

Frans.

Share this post


Link to post
Share on other sites

You are right about this :) Fix will be available in the next release.

 

Regards,

Pavel

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