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


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

Re: Bug, feature or just accidental?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Bug, feature or just accidental?
Date Tue, 02 Aug 2011 22:32:47 +1200
Lines 28
Message-ID <99q22fFaa6U7@mid.individual.net> (permalink)
References <j18dm1$p66$1@speranza.aioe.org> <99psbmFaa6U6@mid.individual.net> <j18j47$6k7$1@speranza.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net D0mBGGZVF3JP7ECJTwZxxQjBil1nlD33ZejFRS3WwtjVsAjhx6
Cancel-Lock sha1:i7EqfuOrkja51HYcbB2ZExru6ow=
User-Agent Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4
In-Reply-To <j18j47$6k7$1@speranza.aioe.org>
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:8404

Show key headers only | View raw


On 08/ 2/11 10:21 PM, boltar2003@boltar.world wrote:
> On Tue, 02 Aug 2011 20:55:18 +1200
> Ian Collins<ian-news@hotmail.com>  wrote:
>>> If I have catch(int i, int j) I get a compile error with gcc but the throw
>>> compiles fine. Also if I have brackets around the throw values it catches
>>> the 2, if I miss out the brackets it catches the 1. Is it simply treating
>>> the brackets as a single expression?
>>
>> You are seeing the comma operator in action.
>>
>> throw(1,2) is throw (1,2).  The result of the expression 1,2 is 2.
>>
>> throw 1,2  is (throw 1),2.  Here the result (2) is discarded.
>
> Fair enough, but I'm surprised it doesn't treat comma seperated values
> as arguments in the same way as a function call would.

throw isn't a function call.

Throw is defined in the standard as

throw-expression:
     throw assignment-expression

The parenthesis are associated with the expression, not the throw.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous 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