Jump to content

Recommended Posts

Hi any comments on the following:

bool test;

test=~test;//result in compliment of test eg if before=true now=false

 

Referring to bit operator: NOT

This operation is performed on a single bit. Its result is the inversion of the actual value of the bit: if it was set to 1 it becomes 0, and if it was 0 it becomes 1:

 

However, in BoostC its used as a urinary operator, which results in

if (test==0) test=~test; //test==1;

 

if (test==1) test=~test; //test==1;

 

To compliment a boolean assume I use:

test=1^test;

 

 

 

Thanks.

Al.

Edited by Alistair George
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...
×
×
  • Create New...