🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by linh (l.) dang Wed, 20 Mar 1996 03:18
Re: static_cast
#3745
Author: linh (l.) dang
Date: Wed, 20 Mar 1996 03:18
42 lines
2089 bytes
>>>> "Matt" == Matt Austern <austern@isolde.mti.sgi.com> writes:

 Matt> In article <314c3f47.1349350@nntp.ix.netcom.com>
 Matt> jdmorris@ix.netcom.com (Jason D. Morris) writes:
 >> Aren't the old C style casts and C++ functional style casts
 >> depricated under the draft standard?

 Matt> No.  It's true that new-style casts (static_cast, dynamic_cast,
 Matt> reinterpret_cast and const_cast) are almost always a better
 Matt> solution, but old-style casts have not been deprecated.

Since static_cast is not always safe, did anyone consider a set of
implicit_cast<T> template functions as part of the standard library ?

e.g:

template<typename From, typename To>
inline To
implicit_cast(From x)
{
  return x;
}

....

These functions are efficient, safe and might be the fatal blow to the
old-style cast.

--
L.D.
-- 
=====================================================================
Linh Dang                                 Nortel Technology
Member of Scientific Staff                Speech Recognition Software
linhd@nortel.ca
=====================================================================
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Re: static_cast
#3754
Author: Nathan Myers, http://www.cantrip...
Date: Thu, 21 Mar 1996 10:49
27 lines
1754 bytes
linh (l.) dang wrote:

> Since static_cast is not always safe, did anyone consider a set of
> implicit_cast<T> template functions as part of the standard library ?

They were considered at the meeting in Tokyo (Nov. '95) but 
rejected as an extension proposal that arrived just too late.
(I gather they were left out of the proposal for the original 
suite of casts because they could be implemented in the library, 
but nobody got around to proposing them to the library group 
until too late.)

If they find wide use they might be added to the next C++ standard.

> These functions are efficient, safe and might be the fatal blow to the
> old-style cast.

One can dream, at least.

Nathan Myers
ncm@cantrip.org  http://www.cantrip.org/
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads