Reynard 0 Posted February 3, 2011 Report Share Posted February 3, 2011 I am unable to cast any data type greater than a char to a bool. bool myFlag = false; unsigned int myInt; void main() { myInt = 0xffff; myFlag = (myInt & 0x0100); } Produces:- bool myFlag = false; 001C 9003 BCF gbl_myFlag,0 unsigned int myInt; void main() { myInt = 0xffff; 0008 6801 SETF gbl_myInt 000A 6802 SETF gbl_myInt+D'1' myFlag = (myInt & 0x0100); 000C 0E00 MOVLW 0x00 000E 1401 ANDWF gbl_myInt, W 0010 6E04 MOVWF CompTempVar586 0012 9003 BCF gbl_myFlag,0 0014 5004 MOVF CompTempVar586, W 0016 A4D8 BTFSS STATUS,Z 0018 8003 BSF gbl_myFlag,0 } It doesn't know "myInt" is an int. SB 7.01, PIC18F4580, XP Pro SP3 Cheers Reynard Quote Link to post Share on other sites
Recommended Posts
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.