??? 06/09/04 07:14 Read: times |
#72145 - RE: Weekend Puzzle Responding to: ???'s previous message |
hi,
z-!z is alway 0. You are wrong. It is question of philosophy - which results are produced with next operations: TRUE - FALSE = ? FALSE - TRUE = ? or, from other side: how can you eject false from true story or truth from lie? Now come back to programming. We all know that ANSI C does not support TRUE and FALSE keywords itself. To use them we need define it: #define TRUE 1 #define FALSE 0 I have not seen any compiler which uses other values when define these keywords. Why? Because ANSI C does not know anything about boolean values as well. To use boolean values you need to define this type. And here we come to interest question - which data type must be defined as boolean? See: typedef int BOOL; typedef bit BOOL; Many compilers for "big" computers use the first line. But with 8051 we have a chance to use the second line because 8051 has many instructions for maintain the bits - it saves RAM and increases the speed of a program. As boolean value may be only 1 or 0 (see defines above) so the bit is the best place to store it in. Finally we come to your post: z-!z is alway 0. After all I said above, try to calculate: 1 - 0 and 0 - 1 Regards, Oleg |