??? 06/08/04 17:13 Read: times Msg Score: +2 +2 Informative |
#72094 - RE: Understanding logic expressions !!! Responding to: ???'s previous message |
The Keil compiler generates the following:
1 unsigned char r1,r2; 2 3 void junk (void) 4 { 5 1 r1 = r1 > r2; 6 1 } 7 ASSEMBLY LISTING OF GENERATED OBJECT CODE ; FUNCTION junk (BEGIN) ; SOURCE LINE # 3 ; SOURCE LINE # 4 ; SOURCE LINE # 5 0000 E500 R MOV A,r1 0002 D3 SETB C 0003 9500 R SUBB A,r2 0005 7F00 MOV R7,#00H 0007 4002 JC ?C0001 0009 7F01 MOV R7,#01H 000B ?C0001: 000B ?C0002: 000B 8F00 R MOV r1,R7 ; SOURCE LINE # 6 000D 22 RET ; FUNCTION junk (END) As you can see, the only values possible are 0 and 1. The ANSI/ISO C standard is pretty specific about the result of a comparison being 0 or 1. Jon |