[英]Why GCC doesn't report any errors or warnings when using WinAPI: COLORREF/RGB?
The type COLORREF
is a typedef for a DWORD
. 类型
COLORREF
是DWORD
的typedef。 The line 线
COLORREF COLOR = (255,255,255);
is equivalent to 相当于
DWORD COLOR = 255;
and therefore compiles fine. 因此编译良好。 It may not do what you want however.
但是,它可能无法满足您的要求。
The reason is that expr1, expr2
yields the value of expr2
in C, so 255, 255, 255
has a value of 255
. 其原因是,
expr1, expr2
得到的值expr2
在C,所以255, 255, 255
具有值255
。 The brackets have no effect here. 括号在这里无效。 See:
看到:
http://en.wikipedia.org/wiki/Comma_operator http://en.wikipedia.org/wiki/Comma_operator
Note that the RGB macro itself just makes the appropriate DWORD
(some number) from red, green and blue components. 请注意,RGB宏本身只是根据红色,绿色和蓝色分量生成适当的
DWORD
(一些数字)。 Numbers essentially are COLORREFs here. 在这里,数字本质上是 COLORREF。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.