双重演员

编程入门 行业动态 更新时间:2024-10-25 01:24:45
本文介绍了双重演员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

熟悉Windows编程的人可能熟悉windowsx.h 标题。在这个头文件中存在使用双重转换的宏,就像这样(希望 这是可读的): #define ComboBox_LimitText(hwndCtl,cchLimit)\ (b)(DWORD)SendMessage((hwndCtl),CB_LIMITTEXT,(W PARAM)(int)(cchLimit),0)) 这是为什么?这对于类型检查有帮助吗? (我想不会)。 感谢您的信息, - Martijn www.sereneconcepts.nl

解决方案

On Sun,2003年11月2日13:33:05 +0100,Martijn < su ********** ***********@hotNOFILTERmail>在comp.lang.c中写道:

熟悉Windows编程的人可能熟悉windowsx.h 标题。在这个头文件中存在使用双重转换的宏,就像这样(希望这是可读的): 你的文字是可读的,代码所做的概念不是。 #define ComboBox_LimitText(hwndCtl,cchLimit)\ ((int)(DWORD)SendMessage((hwndCtl),CB_LIMITTEXT,(W PARAM)(int)( cchLimit),0)) 为什么会这样?这对于类型检查有帮助吗? (我想不会)。 Casts从不帮助进行类型检查,它们专门用来打败 类型检查。 感谢您的信息,

由于各种原因,Windows头文件是一个完整的和/ b 的混乱。如果您真的想深入研究细节,我建议您使用 a Windows编程组或Microsoft的支持组之一。 - Jack Klein 主页: http:// JK-Technology.Com 常见问题解答 comp.lang.c www.eskimo/~scs/C-faq/top.html comp.lang.c ++ www.parashift/c++ -faq-lite / altp.lang.learn.c-c ++ ftp://snurse-l/pub/acllc-c++/faq

"杰克克莱恩 < JA ******* @ spamcop>在消息中写道 news:on ******************************** @ 4ax ...

On Sun,2003年11月2日13:33:05 +0100,Martijn< su ************** *******@hotNOFILTERmail>在comp.lang.c中写道:

熟悉Windows编程的人可能熟悉windowsx.h 标题。在这个头文件中存在使用双重转换的宏,就像这样(希望这是可读的):

你的文本是可读的,代码所做的概念不是。

#define ComboBox_LimitText(hwndCtl,cchLimit)\ ((int)(DWORD)SendMessage((hwndCtl),CB_LIMITTEXT,(W PARAM) (int)(cchLimit),0)) 这是为什么?这对于类型检查有帮助吗? (我想不会)。

强制转换从不帮助进行类型检查,它们专门用来打败类型检查。

感谢您的信息,

由于各种原因,Windows头文件是一个完整的,总体上的混乱。如果您真的想深入研究细节,我建议您使用Windows编程组或Microsoft的支持组。

那个不是他的问题。 他的问题是:什么时候需要,如果有的话,使用 a double cast? 例如: 1.(WPARM)(int)(cchLimit) 2.(WPARM) (cchLimit) 这两个表达式*总是*等价吗?是否有必要使用中间演员表(int)来获得b $ b来获得正确的情况。最终演员到(WPARM)? 只要忽略任何WPARM关于双重投射与单投的一般性问题应该是并且认为是b $ b。 不要分心Windows。这真的是一个C问题。 对你来说,那里的C大师们有什么明确的答案?

xarax< xa *** @ email>潦草地写道:

" Jack Klein" < JA ******* @ spamcop>在消息中写道新闻:在******************************** @ 4ax ... On Sun,2003年11月2日13:33:05 +0100,Martijn< su ****************** ***@hotNOFILTERmail>在comp.lang.c中写道:

>> >那些熟悉Windows编程的人可能熟悉windowsx.h >头。在这个头文件中存在使用双重转换的宏,就像这样(希望>这是可读的):你的文字是可读的,代码所做的概念不是。 > #define ComboBox_LimitText(hwndCtl,cchLimit)\ > > ((int)(DWORD)SendMessage((hwndCtl),CB_LIMITTEXT,(W PARAM)(int)(cchLimit),0))> >为什么是这样?这对于类型检查有帮助吗? (我想不会)。

强制转换从不帮助进行类型检查,它们专门用来打败类型检查。

>感谢您的信息,

由于各种原因,Windows头文件是一个完整的,总体上的混乱。如果您真的想深入研究细节,我建议您使用Windows编程组或Microsoft的支持组。

不是他的问题。 他的问题是:如果有必要,何时使用双重演员? 例如: 1.(WPARM)(int)(cchLimit) 2.(WPARM)(cchLimit)这两个表达式*总是*等价吗?是否有必要使用中间演员(int)来获得正确的情况?最终演员(WPARM)? 只要忽略任何WPARM即可。应该是并且想想关于双重投射与单一投射的一般性问题。不要分心Windows。这真的是一个C问题。 对你们来说,C大师们有什么明确的答案?

我不是C大师,不能回答OP的问题,但是我可以说 一般来说,类型(A)(B)类型的表达式 与(A)某事物不同。 /> 证明: int i; int * p1 =(int *)& i; int * p2 =(int *)(long)& i; p1保证存储我的地址。 p2不是。 - / - Joona Palaste(pa*****@cc.helsinki.fi)----- --------芬兰-------- \ \-- www.helsinki.fi/~palaste ---------------------规则! -------- / 我们是女性。我们有双重标准可以实现。 - Ally McBeal

Hi, Those familiar with Windows programming may be familiar with the windowsx.h header. In this header macros exist that use double casts, like so (hope this is readable): #define ComboBox_LimitText(hwndCtl,cchLimit) \ ((int)(DWORD)SendMessage((hwndCtl),CB_LIMITTEXT,(W PARAM)(int)(cchLimit),0)) Why is this? Does this help in typechecking? (I would think not). Thanks for the info, -- Martijn www.sereneconcepts.nl

解决方案

On Sun, 2 Nov 2003 13:33:05 +0100, "Martijn" <su*********************@hotNOFILTERmail> wrote in comp.lang.c:

Hi, Those familiar with Windows programming may be familiar with the windowsx.h header. In this header macros exist that use double casts, like so (hope this is readable): Your text is readable, the concept of what the code is doing is not. #define ComboBox_LimitText(hwndCtl,cchLimit) \ ((int)(DWORD)SendMessage((hwndCtl),CB_LIMITTEXT,(W PARAM)(int)(cchLimit),0)) Why is this? Does this help in typechecking? (I would think not). Casts never help in type checking, they specifically exist to defeat type checking. Thanks for the info,

For a variety of reasons, Windows header files are a complete and total mess. If you really want to delve into the details, I''d suggest a Windows programming group or one of Microsoft''s support groups. -- Jack Klein Home: JK-Technology.Com FAQs for comp.lang.c www.eskimo/~scs/C-faq/top.html comp.lang.c++ www.parashift/c++-faq-lite/ altp.lang.learn.c-c++ ftp://snurse-l/pub/acllc-c++/faq

"Jack Klein" <ja*******@spamcop> wrote in message news:on********************************@4ax...

On Sun, 2 Nov 2003 13:33:05 +0100, "Martijn" <su*********************@hotNOFILTERmail> wrote in comp.lang.c:

Hi, Those familiar with Windows programming may be familiar with the windowsx.h header. In this header macros exist that use double casts, like so (hope this is readable):

Your text is readable, the concept of what the code is doing is not.

#define ComboBox_LimitText(hwndCtl,cchLimit) \ ((int)(DWORD)SendMessage((hwndCtl),CB_LIMITTEXT,(W PARAM)(int)(cchLimit),0)) Why is this? Does this help in typechecking? (I would think not).

Casts never help in type checking, they specifically exist to defeat type checking.

Thanks for the info,

For a variety of reasons, Windows header files are a complete and total mess. If you really want to delve into the details, I''d suggest a Windows programming group or one of Microsoft''s support groups.

That wasn''t his question. His question is this: When is it necessary, if ever, to use a double cast? For example: 1. (WPARM)(int)(cchLimit) 2. (WPARM)(cchLimit) Are these two expressions *always* equivalent? Is there ever a situation where the intermediate cast (int) is necessary to get a "correct" final cast to (WPARM)? Just ignore whatever "WPARM" is supposed to be and think about the generic question of double casting versus single casting. Don''t get distracted about Windows. This is really a C question. For you C gurus out there, what is the definitive answer?

xarax <xa***@email> scribbled the following:

"Jack Klein" <ja*******@spamcop> wrote in message news:on********************************@4ax...

On Sun, 2 Nov 2003 13:33:05 +0100, "Martijn" <su*********************@hotNOFILTERmail> wrote in comp.lang.c:

> Hi, > > Those familiar with Windows programming may be familiar with the windowsx.h > header. In this header macros exist that use double casts, like so (hope > this is readable): Your text is readable, the concept of what the code is doing is not.

> #define ComboBox_LimitText(hwndCtl,cchLimit) \ > > ((int)(DWORD)SendMessage((hwndCtl),CB_LIMITTEXT,(W PARAM)(int)(cchLimit),0)) > > Why is this? Does this help in typechecking? (I would think not).

Casts never help in type checking, they specifically exist to defeat type checking.

> Thanks for the info,

For a variety of reasons, Windows header files are a complete and total mess. If you really want to delve into the details, I''d suggest a Windows programming group or one of Microsoft''s support groups.

That wasn''t his question. His question is this: When is it necessary, if ever, to use a double cast? For example: 1. (WPARM)(int)(cchLimit) 2. (WPARM)(cchLimit) Are these two expressions *always* equivalent? Is there ever a situation where the intermediate cast (int) is necessary to get a "correct" final cast to (WPARM)? Just ignore whatever "WPARM" is supposed to be and think about the generic question of double casting versus single casting. Don''t get distracted about Windows. This is really a C question. For you C gurus out there, what is the definitive answer?

I am not a C guru and cannot answer the OP''s question, but I can say for certain that in general, an expression of the type (A)(B)something is not the same thing as (A)something. Proof: int i; int *p1 = (int *)&i; int *p2 = (int *)(long)&i; p1 is guaranteed to store i''s address. p2 is not. -- /-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\ \-- www.helsinki.fi/~palaste --------------------- rules! --------/ "We''re women. We''ve got double standards to live up to." - Ally McBeal

更多推荐

双重演员

本文发布于:2023-11-25 11:58:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629654.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:演员

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!