Skip to contentSkip to conversation

what is the char ~ mean

DISCUSSION jywang 3 participants 3 messages Nov 8, 2005

lore
Share & tools
lore

jywang

author
#0 lore raw

in linux source code, i find this line,
~tcp_v4_check(...).

what is the character ~ mean.

#1 lore raw
Quoted 4 lines · jywang

in linux source code, i find this line,
~tcp_v4_check(...).

what is the character ~ mean.

It means 'one's complement of'. Look at the example to understand its usage:

int main(void) {
	/*   4 = 0000 0000 0000 0100 */
	unsigned int value = 4;
	/* 4294967291 = 1111 1111 1111 1011 */
	value = ~value;
}

In your case, this would mean: "create the one's complement of the return value of tcp_v4_check".

\Steve