Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8482

Re: Is it correct? Two same named classes in different unnamed namespace get same typeid

From Qi <no@no.no>
Newsgroups comp.lang.c++
Subject Re: Is it correct? Two same named classes in different unnamed namespace get same typeid
Date 2011-08-05 10:07 +0800
Organization Aioe.org NNTP Server
Message-ID <j1fj8n$7ea$1@speranza.aioe.org> (permalink)
References <j13i7d$reu$1@speranza.aioe.org> <6dcb4c39-e752-4cce-b769-4190aa1e25d2@y24g2000yqb.googlegroups.com>

Show all headers | View raw


On 2011-8-5 4:19, Tom wrote:

> In the example there is no polymorphic class type involved so we do
> not have RTTI but static type information.

I think typeid is always static and compile time information.
So it has no connection with polymorphic.
Am I wrong?

>  From my experience I recommend not to use typeid especially if you are
> using namespaces. I think quite a lot of compilers have problems with
> the same class name in different namespaces. Therefore you can be
> quite sure to have problems sooner or later.


Yup, that's my concern too.
So I will try to avoid typeid.

Thanks for the advice.


-- 
WQ

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is it correct? Two same named classes in different unnamed namespace get same typeid Qi <no@no.com> - 2011-07-31 20:32 +0800
  Re: Is it correct? Two same named classes in different unnamed namespace get same typeid Juha Nieminen <nospam@thanks.invalid> - 2011-08-01 08:36 +0000
    Re: Is it correct? Two same named classes in different unnamed namespace get same typeid Qi <no@no.no> - 2011-08-01 16:59 +0800
  Re: Is it correct? Two same named classes in different unnamed namespace get same typeid Tom <tettigonia@googlemail.com> - 2011-08-04 13:19 -0700
    Re: Is it correct? Two same named classes in different unnamed namespace get same typeid Qi <no@no.no> - 2011-08-05 10:07 +0800
      Re: Is it correct? Two same named classes in different unnamed namespace get same typeid LR <lruss@superlink.net> - 2011-08-05 05:16 -0400
  Re: Is it correct? Two same named classes in different unnamed namespace get same typeid James Kanze <james.kanze@gmail.com> - 2011-08-07 10:44 -0700
    Re: Is it correct? Two same named classes in different unnamed namespace get same typeid LR <lruss@superlink.net> - 2011-08-07 17:18 -0400

csiph-web