The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: donkey on November 12, 2006, 06:33:22 PM

Title: Shame Shame, a C question here !!!!
Post by: donkey on November 12, 2006, 06:33:22 PM
Hi,

I have a question about C header files, yes I know this is an assembly language forum so don't bother pointing it out. I am translating some header files and found the following ...

#define SO_LINGER  0x0080
.
.
.
#define SO_DONTLINGER  (int)(~SO_LINGER)

I have been working under the assumption that this would mean any value that does not have the SO_LINGER bit set, is this correct ?

Donkey
Title: Re: Shame Shame, a C question here !!!!
Post by: tofu-sensei on November 12, 2006, 06:43:58 PM
~ is the one's complement operator, therefore
(int)(~SO_LINGER) = 0xFFFFFF7F (assuming the compiler uses 32-bit integers)

btw, isn't this an assembly language forum?  :wink
Title: Re: Shame Shame, a C question here !!!!
Post by: Tedd on November 13, 2006, 10:41:48 AM
It's simply:

SO_DONTLINGER equ NOT SO_LINGER