Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8409

Re: Bug, feature or just accidental?

From Victor Bazarov <v.bazarov@comcast.invalid>
Newsgroups comp.lang.c++
Subject Re: Bug, feature or just accidental?
Date 2011-08-02 08:08 -0400
Organization A noiseless patient Spider
Message-ID <j18pcq$c4$1@dont-email.me> (permalink)
References (2 earlier) <j18j47$6k7$1@speranza.aioe.org> <buo1ux4f6ob.fsf@dhlpc061.dev.necel.com> <j18jtm$8ie$1@speranza.aioe.org> <99q2kbFaa6U8@mid.individual.net> <j18maj$ea1$1@speranza.aioe.org>

Show all headers | View raw


On 8/2/2011 7:16 AM, boltar2003@boltar.world wrote:
> On Tue, 02 Aug 2011 22:42:18 +1200
> Ian Collins<ian-news@hotmail.com>  wrote:
>> On 08/ 2/11 10:35 PM, boltar2003@boltar.world wrote:
>>> On Tue, 02 Aug 2011 19:29:08 +0900
>>> Miles Bader<miles@gnu.org>   wrote:
>>>> The thing is that the parens are _not_ part of the "throw" statement
>>>> (the syntax of throw is just "throw SOMETHING" -- note, no parens),
>>>> they're just random parens that you can put around any expression.
>>>
>>> I think Stroustrup missed a trick there. It would be very useful to throw
>>> multiple values at the same time instead of having to create an object
>>> to hold them in and throw that. Functions arn't limited to a single argument
>>> so I don't really see a good reason why throw-catch is.
>>
>> Think of throw as more like a return statement than a function call and
>> you'll see that argument dose not make sense.
>
> Why not? Plenty of languages allow multiple return values from a function.
> C++ doesn't because its based on C, but thats no reason why a C++ specific
> feature such as exceptions couldn't support it.

Right, but letting throw accept multiple objects would present an 
inconsistency with the 'return', whereas now it's consistent and 
logical.  Besides, what's the point of throwing multiple objects?  Can 
there occur several exceptional situations at once?  Seems that the most 
severe is always what you want to report [by throwing].  And, just like 
with returning from a function, you're free to wrap your multiple 
objects in a struct and throw that.

V
-- 
I do not respond to top-posted replies, please don't ask

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Bug, feature or just accidental? boltar2003@boltar.world - 2011-08-02 08:49 +0000
  Re: Bug, feature or just accidental? Ian Collins <ian-news@hotmail.com> - 2011-08-02 20:55 +1200
    Re: Bug, feature or just accidental? boltar2003@boltar.world - 2011-08-02 10:21 +0000
      Re: Bug, feature or just accidental? Miles Bader <miles@gnu.org> - 2011-08-02 19:29 +0900
        Re: Bug, feature or just accidental? boltar2003@boltar.world - 2011-08-02 10:35 +0000
          Re: Bug, feature or just accidental? Ian Collins <ian-news@hotmail.com> - 2011-08-02 22:42 +1200
            Re: Bug, feature or just accidental? boltar2003@boltar.world - 2011-08-02 11:16 +0000
              Re: Bug, feature or just accidental? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-02 08:08 -0400
                Re: Bug, feature or just accidental? boltar2003@boltar.world - 2011-08-02 12:40 +0000
                Re: Bug, feature or just accidental? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-02 08:59 -0400
                Re: Bug, feature or just accidental? boltar2003@boltar.world - 2011-08-02 13:23 +0000
                Re: Bug, feature or just accidental? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-02 09:43 -0400
                Re: Bug, feature or just accidental? boltar2003@boltar.world - 2011-08-02 13:53 +0000
                Re: Bug, feature or just accidental? James Lothian <james@firstnamelastname.freeserve.co.uk> - 2011-08-03 07:49 +0100
                Re: Bug, feature or just accidental? "Paul" <pchristor@yahoo.co.uk> - 2011-08-03 10:47 +0100
                Re: Bug, feature or just accidental? Paavo Helde <myfirstname@osa.pri.ee> - 2011-08-02 15:43 -0500
              Re: Bug, feature or just accidental? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-08-02 16:12 +0000
      Re: Bug, feature or just accidental? Ian Collins <ian-news@hotmail.com> - 2011-08-02 22:32 +1200

csiph-web