August 25, 2003 Re: Catch slicing | ||||
---|---|---|---|---|
| ||||
Posted in reply to Heinz Saathoff | 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 vptr. > > Not only that struct but also included structs. The standard says that PODs are classic C-structs which makes sense. This also gives compiler writes more freedom in implementing things. For DMC I know that adding members isn't a problem and I still can memcpy such structs. But it's not guaranteed by the standard. > > - Heinz |
August 27, 2003 Re: Catch slicing | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | "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 > IMO, the second option is enough... Even for POD type, you should catch them by reference as it is possible to derive from a structure and will then have the slicing problem again if you throw again the exception. I don't see much benefit in catch by value.... but then what is the difference with passing parameters to a function by value! |
August 27, 2003 Re: Catch slicing | ||||
---|---|---|---|---|
| ||||
Posted in reply to Philippe Mori | "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 (not > > reference or ptr) > > > > For myself I'd use -wxs2 all the time > > > > IMO, the second option is enough... Even for POD type, you should catch them by reference as it is possible to derive from a structure and will then > have the slicing problem again if you throw again the exception. I don't see > much benefit in catch by value.... but then what is the difference with > passing > parameters to a function by value! Well, one thing with pbv is that it is a must when used on iterators in algorithms. Overall, I agree that only the second would be of use to me, but I was just wanting to cater for sloppy programmers and hard-pressed compiler implementers |
August 29, 2003 Re: Catch slicing | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | >
> Well, one thing with pbv is that it is a must when used on iterators in algorithms.
>
It is for catch clauses that pass-by-value has no reel value for me... For other cases like function parameters, it is different.
|
Copyright © 1999-2021 by the D Language Foundation