typeid does not work in 6.1?

I just ported from NTO6.0 to 6.1 and my code that was using typeid to
determine object types under 6.0 no longer works. It always evaluates to
false. Is this a known bug?

Ex.
std::string temp;
if(typeid(temp) == typeid(std::string))
{
}

Kevin Hykin <kevin.hykin@bepco.com> wrote:

I just ported from NTO6.0 to 6.1 and my code that was using typeid to
determine object types under 6.0 no longer works. It always evaluates to
false. Is this a known bug?

std::string temp;
if(typeid(temp) == typeid(std::string))
{
}

I am unable to recreate that problem using your code example. I modified
it slightly so it would compile:


#include

using namespace std;

int main (int argc, char* argv[])
{
string temp;

if (typeid(temp) == typeid(string))
{
cout << “Works!” << endl;
}

return 0;
}

The if statement evaluates to true, and “Works” is put to the iostream. Do
you have a test case that can illustrate the problem you’re having?

-Adam
amallory@qnx.com

Kevin Hykin <kevin.hykin@bepco.com> wrote:

I just ported from NTO6.0 to 6.1 and my code that was using typeid to
determine object types under 6.0 no longer works. It always evaluates to
false. Is this a known bug?

Ex.
std::string temp;
if(typeid(temp) == typeid(std::string))
{
}

The following program works for me. Can you post an example that fails (that didn’t
before)?

#include <stdio.h>
#include

using namespace std;

int main(void)
{
std::string temp;

if ( typeid(temp) == typeid(std::string) ) {
printf(“True\n”);
}
else {
printf(“False\n”);
}

return 0;
}



\

cburgess@qnx.com

I have had problems under Linux with some versions of gcc, et al and RTTI
functions. Some other versions worked fine.

Bill Caroselli


“Kevin Hykin” <kevin.hykin@bepco.com> wrote in message
news:9meimq$59u$1@inn.qnx.com

I just ported from NTO6.0 to 6.1 and my code that was using typeid to
determine object types under 6.0 no longer works. It always evaluates to
false. Is this a known bug?

Ex.
std::string temp;
if(typeid(temp) == typeid(std::string))
{
}