T
ttomic
Consider this CLI example from VS2005 SP1:
// ************************************
using namespace System;
#pragma unmanaged
struct S {
int x;
S() : x(0) {}
typedef void(S::*unspecified_bool_type)();
operator unspecified_bool_type() const { return x != 0 ?
&S:ummy : 0; }
void Dummy() {}
};
inline int ret_bool(const S& s) {
return bool(s);
}
#pragma managed
int main () {
S s;
// if(ret_bool(s))
if(s)
Console::WriteLine("true");
else
Console::WriteLine("false");
return 0;
}
// ********************************************************
Program will output "true".
If we replace "if(s)" with "if(ret_bool(s))" program will output
correct string: "false".
It look's like
http://support.microsoft.com/default.aspx?kbid=823071
but I thought that was fixed long time ago.
Should I pollute my code with "__asm mov eax, 0;" again ?
Can someone help me?
// ************************************
using namespace System;
#pragma unmanaged
struct S {
int x;
S() : x(0) {}
typedef void(S::*unspecified_bool_type)();
operator unspecified_bool_type() const { return x != 0 ?
&S:ummy : 0; }
void Dummy() {}
};
inline int ret_bool(const S& s) {
return bool(s);
}
#pragma managed
int main () {
S s;
// if(ret_bool(s))
if(s)
Console::WriteLine("true");
else
Console::WriteLine("false");
return 0;
}
// ********************************************************
Program will output "true".
If we replace "if(s)" with "if(ret_bool(s))" program will output
correct string: "false".
It look's like
http://support.microsoft.com/default.aspx?kbid=823071
but I thought that was fixed long time ago.
Should I pollute my code with "__asm mov eax, 0;" again ?
Can someone help me?