一个真的困扰我的问题...... [英] A Question that really bothers me...
问题描述
好了,问题就是这个。
我用Visual Studio 2008编译了一些旧代码(代码是
最初在Visual Studio 6中编写) )我有这个错误:
错误1错误C2681:''void *'':无效的表达式类型为
dynamic_cast c:\Works \\ \\ BaCCTester\Dev\Addins\Utils
\ CommonDataManipulators \Sources \CommonDataFree.cpp 121
CommonDataManipulators
和有问题的代码行是:
....
FunctionResponse * pFunctionResponse =
ACE_dynamic_cast(FunctionResponse *,data) ;
....
因此,当我转换时,dynamic_cast不适用于void指针
指向void的指针我放弃了所有类型
的信息。但是,让我三思而后的关于
上一句话的核心性的原因是,这段代码完全可以在Visual B / B $ Studio $ 6下编译。我想知道更多关于这个问题所以任何帮助,
参考,链接等都非常高度赞赏。
谢谢,
Nikola Tanev
Ok now the problem is this.
I have compiled some old code with Visual Studio 2008 (the code was
originally writen in Visual Studio 6) and i have this error:
Error 1 error C2681: ''void *'' : invalid expression type for
dynamic_cast c:\Works\BaCCTester\Dev\Addins\Utils
\CommonDataManipulators\Sources\CommonDataFree.cpp 121
CommonDataManipulators
and the problematic line of code is this:
....
FunctionResponse* pFunctionResponse =
ACE_dynamic_cast(FunctionResponse*, data);
....
So it is logicaly that dynamic_cast does not work for void-pointers
since when I converted the pointer to void I have given up all type
information. But what makes me think twice about the corectness of the
previous sentence is that this code compiles perfectly under Visual
Studio 6. I would like to know more about this issue so any help,
references, links and so are highly appriciated.
Thank You,
Nikola Tanev
推荐答案
更多想法添加:
RTTI开启
2月26日,上午10:33,j123 ... @ gmail.com < j123 ... @ gmail.comwrote:
ONE MORE THINK TO ADD:
RTTI is turned ON
On Feb 26, 10:33 am, "j123...@gmail.com" <j123...@gmail.comwrote:
好了,问题是这个。
我编了一些使用Visual Studio 2008的旧代码(代码是最初在Visual Studio 6中写的
),我有这个错误:
错误1错误C2681:'' void *'':无效的表达式类型
dynamic_cast c:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\ _CommonDataFree.cpp 121
CommonDataManipulators
和有问题的代码行是:
...
FunctionResponse * pFunctionResponse =
ACE_dynamic_cast(FunctionResponse *,data);
...
所以它是逻辑上,dynamic_cast不适用于void-pointers
,因为当我将指针转换为void时,我放弃了所有类型的
信息。但是,让我三思而后的关于
上一句话的核心性的原因是,这段代码完全可以在Visual B / B $ Studio $ 6下编译。我想知道更多关于这个问题所以任何帮助,
引用,链接等等都是高度关注的。
谢谢你,
Nikola Tanev
Ok now the problem is this.
I have compiled some old code with Visual Studio 2008 (the code was
originally writen in Visual Studio 6) and i have this error:
Error 1 error C2681: ''void *'' : invalid expression type for
dynamic_cast c:\Works\BaCCTester\Dev\Addins\Utils
\CommonDataManipulators\Sources\CommonDataFree.cpp 121
CommonDataManipulators
and the problematic line of code is this:
...
FunctionResponse* pFunctionResponse =
ACE_dynamic_cast(FunctionResponse*, data);
...
So it is logicaly that dynamic_cast does not work for void-pointers
since when I converted the pointer to void I have given up all type
information. But what makes me think twice about the corectness of the
previous sentence is that this code compiles perfectly under Visual
Studio 6. I would like to know more about this issue so any help,
references, links and so are highly appriciated.
Thank You,
Nikola Tanev
2月26日上午10:33,j123 ... @ gmail.com < j123 ... @ gmail.comwrote:
On Feb 26, 10:33 am, "j123...@gmail.com" <j123...@gmail.comwrote:
现在问题是这个。
Ok now the problem is this.
我用Visual Studio 2008编译了一些旧代码(
代码最初在Visual Studio 6中编写)和我有这个
错误:
I have compiled some old code with Visual Studio 2008 (the
code was originally writen in Visual Studio 6) and i have this
error:
错误1错误C2681:''void *'':<的表达式类型无效br />
dynamic_cast c:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ b $ b CommonDataManipulators
Error 1 error C2681: ''void *'' : invalid expression type for
dynamic_cast c:\Works\BaCCTester\Dev\Addins\Utils
\CommonDataManipulators\Sources\CommonDataFree.cpp 121
CommonDataManipulators
和有问题的代码行是:
...
FunctionResponse * pFunctionResponse =
ACE_dynamic_cast(FunctionResponse *,data);
...
and the problematic line of code is this:
...
FunctionResponse* pFunctionResponse =
ACE_dynamic_cast(FunctionResponse*, data);
...
因此,当我将指针转换为void时,dynamic_cast对
void-pointers不起作用是逻辑上的。
有放弃所有类型的信息。但是让我觉得两个关于前一句话的核心性的两次是
这段代码在Visual Studio 6下完美编译。我会
想了解更多关于这个问题的信息,所以任何帮助,参考资料,
链接等都是高度关注的。
So it is logicaly that dynamic_cast does not work for
void-pointers since when I converted the pointer to void I
have given up all type information. But what makes me think
twice about the corectness of the previous sentence is that
this code compiles perfectly under Visual Studio 6. I would
like to know more about this issue so any help, references,
links and so are highly appriciated.
真正的问题是ACE_dynamic_cast是什么。我怀疑
它是一个宏,并且可能根据
编译器的不同而扩展,但我真的不知道。
>
-
James Kanze(GABI软件)电子邮件:ja ********* @ gmail.com
Conseils eninformatiqueorientéeobjet /
Beratung in objektorientierter Datenverarbeitung
9placeSémard,78210 St.-Cyr-l''coco,France,+ 33(0)1 30 23 00 34
The real question is what ACE_dynamic_cast is. I suspect that
it''s a macro, and probably expands differently depending on the
compiler, but I really don''t know.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34
2月26日上午11:37,James Kanze< james.ka ... @ gmail.comwrote:
On Feb 26, 11:37 am, James Kanze <james.ka...@gmail.comwrote:
2月26日上午10点33分,j123 ... @ gmail.com < j123 ... @ gmail.comwrote:
On Feb 26, 10:33 am, "j123...@gmail.com" <j123...@gmail.comwrote:
现在问题是这个。
我用Visual编译了一些旧代码Studio 2008(
代码最初是在Visual Studio 6中编写的)我有这个
错误:
错误1错误C2681:'' void *'':无效的表达式类型
dynamic_cast c:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\ _CommonDataFree.cpp 121
CommonDataManipulators
和有问题的代码行是:
...
FunctionResponse * pFunctionResponse =
ACE_dynamic_cast(FunctionResponse *,data);
...
因此,逻辑上说dynamic_cast不适用于
void-pointers因为当我将指针转换为void时我
放弃了所有类型信息。但是让我觉得两个关于前一句话的核心性的两次是
这段代码在Visual Studio 6下完美编译。我会
想了解更多关于这个问题的信息,所以任何帮助,参考资料,
链接等都是高度关注的。
Ok now the problem is this.
I have compiled some old code with Visual Studio 2008 (the
code was originally writen in Visual Studio 6) and i have this
error:
Error 1 error C2681: ''void *'' : invalid expression type for
dynamic_cast c:\Works\BaCCTester\Dev\Addins\Utils
\CommonDataManipulators\Sources\CommonDataFree.cpp 121
CommonDataManipulators
and the problematic line of code is this:
...
FunctionResponse* pFunctionResponse =
ACE_dynamic_cast(FunctionResponse*, data);
...
So it is logicaly that dynamic_cast does not work for
void-pointers since when I converted the pointer to void I
have given up all type information. But what makes me think
twice about the corectness of the previous sentence is that
this code compiles perfectly under Visual Studio 6. I would
like to know more about this issue so any help, references,
links and so are highly appriciated.
真正的问题是ACE_dynamic_cast是什么。我怀疑
它是一个宏,并且可能根据
编译器的不同而扩展,但我真的不知道。
>
-
James Kanze(GABI软件)电子邮件:james.ka ... @ gmail.com
Conseils eninformatiqueorientéeobjet/
Beratung in objektorientierter Datenverarbeitung
9placeSémard,78210 St.-Cyr-l''coco,France,+ 33(0)1 30 23 00 34
The real question is what ACE_dynamic_cast is. I suspect that
it''s a macro, and probably expands differently depending on the
compiler, but I really don''t know.
--
James Kanze (GABI Software) email:james.ka...@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34
是的它是一个宏
#define ACE_dynamic_cast(TYPE,EXPR)dynamic_cast< TYPE(EXPR)
这是一个标准dynamic_cast,它来自ACE库
Yes it is a macro
# define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast<TYPE(EXPR)
actualy it is a standard dynamic_cast and it is from the ACE libraries
这篇关于一个真的困扰我的问题......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!