Topic: New keywords since ARM?


Author: schuenem@Informatik.TU-Muenchen.DE (Ulf Schuenemann)
Date: 25 May 1994 16:39:28 GMT
Raw View
Path: schuenem
Newsgroups: comp.std.c++
Distribution: world
Followup-To:
References: <BWH.94May13083857@native.cis.ufl.edu> <JASON.94May13155501@deneb.cygnus.com>
From: schuenem@Informatik.TU-Muenchen.DE (Ulf Schuenemann)
Organization: Technische Universitaet Muenchen, Germany
Subject: Re: New keywords since ARM?
Keywords:

In article <JASON.94May13155501@deneb.cygnus.com>, jason@cygnus.com (Jason Merrill) writes:
|> >>>>> Brian Hook <bwh@native.cis.ufl.edu> writes:
|>
|> > What new keywords have been introduced (via WP) or are under serious
|> > consideration?  I don't have the WP, unfortunately.  Bruce Eckel's latest
|> > article in Embedded Systems (?) mentions a new keyword "mutable"....
|>
|> Also bool, true, false, static_cast, dynamic_cast, const_cast,
|> reinterpret_cast, typeid.
|>
|> Jason

I do not know when it was introduced, but "wchar_t" as a keyword is quite
new I think. Besides: I would appreciate "long char" as a new builtin
type, and "wchar_t" just a typedef to "long char" (not a keyword!).


I do not know the differences between the different kinds of casts,
neithter their syntax (except dynamic_cast<X>). But especially I wonder,
what's about overloading:

Can I overload static_cast, dynamic_cast, const_cast and reinterpret_cast
all together, and still the old form of the cast ???

struct X {
 operator int  (); // old cast
 static_cast<int> ();
 dynamic_cast<int> ();
 const_cast<int>  ();
 reinterpret_cast<int> ();
};



Ulf Schuenemann

--------------------------------------------------------------------
Ulf Sch   nemann
Institut f   r Informatik, Technische Universit   t M   nchen.
email: schuenem@informatik.tu-muenchen.de
WWW:   http://hphalle2/~schuenem  (currently not available from outside)




Author: jason@cygnus.com (Jason Merrill)
Date: Wed, 25 May 1994 21:14:34 GMT
Raw View
>>>>> Ulf Schuenemann <schuenem@Informatik.TU-Muenchen.DE> writes:

> Can I overload static_cast, dynamic_cast, const_cast and reinterpret_cast
> all together, and still the old form of the cast ???

> struct X {
>  operator int  (); // old cast
>  static_cast<int> ();
>  dynamic_cast<int> ();
>  const_cast<int>  ();
>  reinterpret_cast<int> ();
> };

No.  No new operators are created; {static,const,reinterpret}_cast just
represent subsets of the C cast notation.  They were added for clarity and
safety.

Jason




Author: kanze@us-es.sel.de (James Kanze)
Date: 26 May 1994 16:01:16 GMT
Raw View
In article <JASON.94May25141434@deneb.cygnus.com> jason@cygnus.com
(Jason Merrill) writes:

|> >>>>> Ulf Schuenemann <schuenem@Informatik.TU-Muenchen.DE> writes:

|> > Can I overload static_cast, dynamic_cast, const_cast and reinterpret_cast
|> > all together, and still the old form of the cast ???

|> > struct X {
|> >  operator int  (); // old cast
|> >  static_cast<int> ();
|> >  dynamic_cast<int> ();
|> >  const_cast<int>  ();
|> >  reinterpret_cast<int> ();
|> > };

|> No.  No new operators are created; {static,const,reinterpret}_cast just
|> represent subsets of the C cast notation.  They were added for clarity and
|> safety.

But there is an interesting question there:

 struct X
 {
     operator int() ;
 } ;

 X  x ;
 (int)x ;  //  Calls user function, I presume.
 static_cast<int>x ; //  User function?
 dynamic_cast<int>x ; //  ?? (suppose that X also has a
    //      virtual function)
 const_cast<int>x ; //  ??
 reinterpret_cast<int>x ;//  ??

Intuitively, I would expect the user conversion for static_cast, and
the built-in version for const_cast and reinterpret_cast.  I have no
idea what to expect for dynamic_cast.

I don't have my copy of the proposal handy to verify, but offhand, if
I remember right, const_cast and reinterpret_cast cannot be used on
class type objects, so the problem cannot occur.  I'm even less sure
about dynamic_cast, but I have vague memories that it is also only
valid on pointers and references.
--
James Kanze                       email: kanze@lts.sel.alcatel.de
GABI Software, Sarl., 8 rue du Faisan, F-67000 Strasbourg, France
Conseils en informatique industrielle --
                   -- Beratung in industrieller Datenverarbeitung




Author: lmb@pointer.han.de (Lars Marowsky-Bree)
Date: 17 May 1994 17:54:00 +0200
Raw View
Quoting jason,
topic 'Re: New keywords since ARM?', area /comp/std/c++, stardate 13.05.94:

>> consideration?  I don't have the WP, unfortunately.  Bruce Eckel's latest
>> article in Embedded Systems (?) mentions a new keyword "mutable"....
>Also bool, true, false, static_cast, dynamic_cast, const_cast,
>reinterpret_cast, typeid.

Is there/Will there be an  updated  ARM  (or something like it) in a
reasonable time?  I have lost :( my copy of the ARM and  don't  want
to  buy  to  books  to  cover the actual standard of C++, but at the
moment I  feel  slightly  bad  having  to  face  all  dangers of C++
unARMed;)




--
Lars Marowsky-Bree               PGP-key available via return receipt
VirNet: @9:492/7158 Fido: @2:2449/620.16 InterNet: lmb@pointer.han.de
PGP fingerprint:     CF FC 3A F0 86 F1 D3 EB  79 8A CF 75 4F 4C 81 DF
## CrossPoint v3.0 ##




Author: bwh@native.cis.ufl.edu (Brian Hook)
Date: 13 May 1994 12:38:57 GMT
Raw View
What new keywords have been introduced (via WP) or are under serious
consideration?  I don't have the WP, unfortunately.  Bruce Eckel's latest
article in Embedded Systems (?) mentions a new keyword "mutable"....


Thanks,

Brian
--
+-----------------------------------------------------------------+
| Brian Hook            | Specializing in real-time 3D graphics   |
| Box 90315             |-----------------------------------------|
| Gainesville, FL 32607 | Internet: bwh@cis.ufl.edu | Free Tibet! |
+-----------------------------------------------------------------+




Author: jason@cygnus.com (Jason Merrill)
Date: Fri, 13 May 1994 22:55:01 GMT
Raw View
>>>>> Brian Hook <bwh@native.cis.ufl.edu> writes:

> What new keywords have been introduced (via WP) or are under serious
> consideration?  I don't have the WP, unfortunately.  Bruce Eckel's latest
> article in Embedded Systems (?) mentions a new keyword "mutable"....

Also bool, true, false, static_cast, dynamic_cast, const_cast,
reinterpret_cast, typeid.

Jason




Author: davidc@bruce.cs.monash.edu.au (David Chatterton)
Date: 15 May 1994 03:59:50 GMT
Raw View
Jason Merrill (jason@cygnus.com) wrote:
: >>>>> Brian Hook <bwh@native.cis.ufl.edu> writes:

: > What new keywords have been introduced (via WP) or are under serious
: > consideration?  I don't have the WP, unfortunately.  Bruce Eckel's latest
: > article in Embedded Systems (?) mentions a new keyword "mutable"....

: Also bool, true, false, static_cast, dynamic_cast, const_cast,
: reinterpret_cast, typeid.

And beware of using and, and_eq, bitand, bitor, compl, not, or, or_eq,
xor, xor_eq, namespace and using.

David

David Chatterton     | "A new character has come on the scene (I am sure I did
Comp Sci Department, | not invent him, I did not even want him, though I like
Monash Uni, Clayton, | him, but there he came, walking out of the woods of
Australia, 3168.     | Ithilien): Faramir, the brother of Boromir."
Phone: 03 905 5375   | - in a letter from JRR Tolkien to his son, 4 May 1944.
email: davidc@bruce.cs.monash.edu.au