Jump to content
Sign in to follow this  

warning message meaning

Recommended Posts

Guest JoeB

this means that on line 60, you are placing a 16-bit value into an 8-bit value, so the upper 8-bits of the 16-bit value will be lost.




unsigned int a   = 0xF1F2;
unsigned char b;
unsigned char c;

b = a; // warning
c = (unsigned char)a; // cast stops warning


now, values b and c will contain 0xF2 and *not* 0xF1F2 because the upper 8-bits of 'a' wont fit.


you should use a cast (as shown above) if you dont mind losing the upper 8-bits.




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.

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.

Sign in to follow this  

  • Create New...