Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Catch slicing
Walter How hard would it be to add a (non-default, I suppose) flag (-wxs) to warn when catching by value for non-fundamental, or for non-POD, types, as in: class A {}; class B : public A {}; try { throw B() } catch(A a) // "Warning: Catch clause type is by value for polymorphic type" { } It'd be sweet (and would get DMC++ a special mention in Part 5, which I may do next). Matthew Aug 17 2003
It's not so easy to tell that a class has been derived from, such as if class B is in another file. "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bhpg7o$1sfb$1 digitaldaemon.com...Walter How hard would it be to add a (non-default, I suppose) flag (-wxs) to warn when catching by value for non-fundamental, or for non-POD, types, as in: class A {}; class B : public A {}; try { throw B() } catch(A a) // "Warning: Catch clause type is by value for polymorphic Aug 20 2003
I appreciate that, but surely it's possible to readily deduce that a non-POD type is being caught by value? "Walter" <walter digitalmars.com> wrote in message news:bi1l46$1lbs$4 digitaldaemon.com...It's not so easy to tell that a class has been derived from, such as if class B is in another file. "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bhpg7o$1sfb$1 digitaldaemon.com...Walter How hard would it be to add a (non-default, I suppose) flag (-wxs) to Aug 20 2003
What's a POD? "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bi1piu$1rrj$1 digitaldaemon.com...I appreciate that, but surely it's possible to readily deduce that a Aug 21 2003
Plain Old Data. Stuff with ctors/dtors/copy-assignment ops/etc. I'm pretty sure it's defined in the standard. I'll have a look. "Walter" <walter digitalmars.com> wrote in message news:bi4cq6$2n5h$1 digitaldaemon.com...What's a POD? "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bi1piu$1rrj$1 digitaldaemon.com...I appreciate that, but surely it's possible to readily deduce that a Aug 21 2003
3.9 "Matthew Wilson" <dmd synesis.com.au> wrote in message news:bi4cta$2n97$1 digitaldaemon.com...Plain Old Data. Stuff with ctors/dtors/copy-assignment ops/etc. I'm pretty sure it's defined in the standard. I'll have a look. "Walter" <walter digitalmars.com> wrote in message news:bi4cq6$2n5h$1 digitaldaemon.com...What's a POD? "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bi1piu$1rrj$1 digitaldaemon.com...I appreciate that, but surely it's possible to readily deduce that a Aug 21 2003
Matthew Wilson schrieb...Plain Old Data. Stuff with ctors/dtors/copy-assignment ops/etc. Aug 22 2003
Yes, it was a mistake. And yes, I agree with all that you've said about POD "Heinz Saathoff" <hsaat bre.ipnet.de> wrote in message news:MPG.19afdfd9e86c795f9896ce news.digitalmars.com...Matthew Wilson schrieb...Plain Old Data. Stuff with ctors/dtors/copy-assignment ops/etc. Aug 22 2003
Hmm. I would think that a POD type would be defined by not having a vptr. "Heinz Saathoff" <hsaat bre.ipnet.de> wrote in message news:MPG.19afdfd9e86c795f9896ce news.digitalmars.com...Matthew Wilson schrieb...Plain Old Data. Stuff with ctors/dtors/copy-assignment ops/etc. Aug 25 2003
Walter schrieb...Hmm. I would think that a POD type would be defined by not having a vptr. Aug 25 2003
Maybe we could have two levels -wxs1 - whatever meaningful definition of non-POD types being caught by value (not reference or ptr) -wxs2 - any type other than fundamental types being caught by value (not reference or ptr) For myself I'd use -wxs2 all the time "Heinz Saathoff" <hsaat bre.ipnet.de> wrote in message news:MPG.19b3f7e93fbe82389896cf news.digitalmars.com...Walter schrieb...Hmm. I would think that a POD type would be defined by not having a Aug 25 2003
"Matthew Wilson" <matthew stlsoft.org> a écrit dans le message de news:bicnia$938$1 digitaldaemon.com...Maybe we could have two levels -wxs1 - whatever meaningful definition of non-POD types being caught by value (not reference or ptr) -wxs2 - any type other than fundamental types being caught by value (not reference or ptr) For myself I'd use -wxs2 all the time Aug 27 2003
"Philippe Mori" <philippe_mori hotmail.com> wrote in message news:biirgo$ida$1 digitaldaemon.com..."Matthew Wilson" <matthew stlsoft.org> a écrit dans le message de news:bicnia$938$1 digitaldaemon.com...Maybe we could have two levels -wxs1 - whatever meaningful definition of non-POD types being caught by value (not reference or ptr) -wxs2 - any type other than fundamental types being caught by value Aug 27 2003
Well, one thing with pbv is that it is a must when used on iterators in algorithms. Aug 29 2003
|