Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: printing te...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 12 Topic 9581 of 9831
Post > Topic >>

Re: printing template argument

by Greg Herlihy <greghe@[EMAIL PROTECTED] > May 10, 2008 at 06:14 AM

On May 9, 8:23 pm, Sean Hunt <ride...@[EMAIL PROTECTED]
> wrote:
> On May 8, 9:27 pm, Venkat <swara...@[EMAIL PROTECTED]
> wrote:
>
> > While typeid(C).name() is guaranteed to be unique for each class C,
> > it is NOT guaranteed to be anything human-understandable.  This
> > makes the function rather useless, but that's what the standard says.
>
> Unfortunately, not even. The result of type_info.name() is
> unspecified, and no requirements are put onto it. "" is a perfectly
> valid value of type_info.name() for any and all types.

No - according to the C++ Standard, type_info name() returns an
implementation-defined NTBS (null-terminated byte string) as the name
of the requested type. [§18.5.1/7] Furthermore, according to
§18.5.1/1, a type_info record effectively stores a pointer to a "name"
for a type. Therefore, in order for typeid name() to "name" (that is,
identify) a particular type, the string that type_info name() returns
a) cannot be empty (because an empty string would not name anything)
and b) must be a name different from the name that type_info name()
returns for any other type (since such a name would not unambiguously
identify its type).

Greg




-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 12 Posts in Topic:
printing template argument
Venkat <swara101@[EMAI  2008-05-08 03:31:00 
Re: printing template argument
Alex <aleskx@[EMAIL PR  2008-05-08 09:03:56 
Re: printing template argument
mcostalba <mcostalba@[  2008-05-08 09:13:27 
Re: printing template argument
Venkat <swara101@[EMAI  2008-05-08 21:27:56 
Re: printing template argument
Joe Gottman <jgottman@  2008-05-08 21:38:44 
Re: printing template argument
Sarang <sarangbaheti@[  2008-05-09 09:22:32 
Re: printing template argument
Stuart Golodetz <sgolo  2008-05-09 21:13:46 
Re: printing template argument
Seungbeom Kim <musiphi  2008-05-09 21:22:54 
Re: printing template argument
Sean Hunt <rideau3@[EM  2008-05-09 21:23:14 
Re: printing template argument
Greg Herlihy <greghe@[  2008-05-10 06:14:40 
Re: printing template argument
Pete Becker <pete@[EMA  2008-05-10 14:13:29 
Re: printing template argument
Edward Rosten <Edward.  2008-05-13 10:53:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:54:54 CDT 2008.