Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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

List of 35 messages in thread
TopicAuthorDate
Weekend Puzzle            01/01/70 00:00      
   RE: Weekend Puzzle            01/01/70 00:00      
   RE: Weekend Puzzle            01/01/70 00:00      
      RE: Weekend Puzzle            01/01/70 00:00      
      RE: Weekend Puzzle            01/01/70 00:00      
         RE: Weekend Puzzle            01/01/70 00:00      
         RE: Weekend Puzzle            01/01/70 00:00      
            RE: Weekend Puzzle            01/01/70 00:00      
               RE: Weekend Puzzle            01/01/70 00:00      
   RE: Weekend Puzzle            01/01/70 00:00      
      RE: Weekend Puzzle            01/01/70 00:00      
         RE: Weekend Puzzle            01/01/70 00:00      
            RE: Weekend Puzzle            01/01/70 00:00      
               RE: Weekend Puzzle            01/01/70 00:00      
            RE: Weekend Puzzle            01/01/70 00:00      
               RE: Weekend Puzzle            01/01/70 00:00      
            RE: Weekend Puzzle            01/01/70 00:00      
               RE: Weekend Puzzle            01/01/70 00:00      
                  RE: Weekend Puzzle            01/01/70 00:00      
                     RE: Weekend Puzzle            01/01/70 00:00      
                  RE: Weekend Puzzle            01/01/70 00:00      
                     RE: Weekend Puzzle            01/01/70 00:00      
   Understanding logic expressions !!!            01/01/70 00:00      
      RE: Understanding logic expressions !!!            01/01/70 00:00      
   RE: Weekend Puzzle            01/01/70 00:00      
      RE: Weekend Puzzle            01/01/70 00:00      
         RE: Weekend Puzzle            01/01/70 00:00      
   RE: Weekend Puzzle            01/01/70 00:00      
   My Conclusion            01/01/70 00:00      
      RE: My Conclusion            01/01/70 00:00      
   Whats the trick, Michael ?            01/01/70 00:00      
      RE: Whats the trick, Michael ?            01/01/70 00:00      
         RE: Whats the trick, Michael ?            01/01/70 00:00      
            RE: Whats the trick, Michael ?            01/01/70 00:00      
               RE: Whats the trick, Michael ?            01/01/70 00:00      

Back to Subject List