![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bitwise negation | dLloydm | Shell Programming and Scripting | 3 | 05-17-2007 10:57 AM |
| resetting counter using bitwise XOR | mrgubbala | High Level Programming | 1 | 09-14-2006 01:58 AM |
| bitwise operators | areef4u | UNIX for Advanced & Expert Users | 9 | 08-04-2006 05:39 AM |
| Bit-fields and Bitwise operators | amatsaka | High Level Programming | 3 | 04-23-2002 05:13 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
bitwise and if
Hi
Suppose we have these code lines: #define _IN_USE 0x001 /* set when process slot is in use */ #define _EXITING 0x002 /* set when exit is expected */ #define _REFRESHING 0x004 ... 1 main () { 2 3 unsigned r_flags =_REFRESHING; 4 5 if (r_flag & _IN_USE){ 6 if (r_flag & _EXITING){ 7 printf("EXITING"); 8 } 9 if (r_flag & _REFRESHING){ 10 printf("REFRESHING"); 11 } 12 } 13 } Will i see on the screen the string REFRESING ? (line 10) Can I say that REFRESCHING and EXITING are two particular cases of the more generic IN_USE? Than you in advance |
| Forum Sponsor | ||
|
|
|
|||
|
I tried on my own and I can say that
given that code lines, the line 10 will never be active because the condition in in the if at line 5 can't be true since REFRESING is 0100 (low foru bits) while IN_USE 0001 it could be true if REFRESING = 01001. So I can't say that EXITING and REFRESHING are two particular cases of IN_USE but they are different cases. Are you agree with me? |
|
|||
|
Quote:
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|