Re: RTTI typeinfo pointers

From: tom_usenet (tom_usenet_at_hotmail.com)
Date: 06/01/04


Date: Tue, 01 Jun 2004 17:24:19 +0100

On Tue, 01 Jun 2004 16:35:11 +0100, Asfand Yar Qazi
<im_not_giving_it_here@i_hate_spam.com> wrote:

>Hi,
>
>Will the std::type_info object returned by typeid be the same
>object every time it is called for a given type?

No (specifically on Windows with a type defined both in a .exe and a
.dll), and the standard doesn't require it. The objects must compare
equal though, of course.

>
>Can there ever be a chance that a std::type_info object returned
>by typeid for two different types will share the same memory
>address?

No, it wouldn't be conforming.

> Lets say, for example, I want to use the address of the
>type_info object as a hash value.

type_info objects work well in a sorted container, due to their
"before" member function. But hashing by pointer value should be
reliable on some platforms at least, just not guaranteed to work by
the standard, and it probably won't work on Windows.

Tom

-- 
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html


Relevant Pages

  • Re: difference between a .dll and .ocx????
    ... Windows), then it must be a COM library since, that's the architecture ... it's a function that is called when the DLL ... class definitions or just function libraries is actually besides the ... about the .dll or .exe adhering to the COM standard. ...
    (microsoft.public.dotnet.framework)
  • Re: Using VB6 dll in Delphi app.
    ... to make a *windows standard* .dll with VB6. ... The trouble occurs when we try to use it in a Delphi app. ...
    (microsoft.public.vb.general.discussion)
  • Re: Controlling Windows Services
    ... The _standard_ C++ language, ... Try asking in a Visual C++ or Windows newsgroup. ... Read the FAQ and Welcome.txt below. ...
    (comp.lang.cpp)
  • Re: IDE cs5530 hda: lost interrupt
    ... According to motherboard´s designers INTR ... are standard and Windows XP run too without any changes. ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: Windows media Player error
    ... Singapore Website Design ... Windows XP FAQ ... The application or the dll c:\windows\system32\MSVFW32.dll is not a valid ...
    (microsoft.public.windowsxp.general)

Loading