两个等号的线路吗? [英] Two Equal Signs in One Line?
问题描述
可能有人请解释一下这样做,以及它如何是合法的C code吗?我发现在这个code此行:<一href=\"http://$c$c.google.com/p/com$p$pssion-$c$c/downloads/list\">http://$c$c.google.com/p/com$p$pssion-$c$c/downloads/list,这是维特算法自适应哈夫曼编码的一个 C实现
Could someone please explain what this does and how it is legal C code? I found this line in this code: http://code.google.com/p/compression-code/downloads/list, which is a C implementation of the Vitter algorithm for Adaptive Huffman Coding
ArcChar = ArcBit = 0;
从功能:
void arc_put1 (unsigned bit)
{
ArcChar <<= 1;
if( bit )
ArcChar |= 1;
if( ++ArcBit < 8 )
return;
putc (ArcChar, Out);
ArcChar = ArcBit = 0;
}
ArcChar是 INT
和ArcBit是 unsigned char型
推荐答案
恩pression值(A = B)
是乙
,这样你就可以把它们连这种方式。他们还右结合的,所以这是可行的。
The value of the expression (a = b)
is b
, so you can chain them this way. They are also right-associative, so it all works out.
基本上
ArcChar = ArcBit = 0;
时(约 1 )一样
ArcBit = 0;
ArcChar = 0;
以来的首次assigment的值是分配的值,从而 0
。
至于类型,即使 ArcBit
是 unsigned char型
分配的结果将得到扩大至 INT
。
Regarding the types, even though ArcBit
is an unsigned char
the result of the assignment will get widened to int
.
1 这不是的究竟的相同,不过,为R ..指出,在下面留言。
1 It's not exactly the same, though, as R.. points out in a comment below.
这篇关于两个等号的线路吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!