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


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

Re: Bug, feature or just accidental?

From Miles Bader <miles@gnu.org>
Newsgroups comp.lang.c++
Subject Re: Bug, feature or just accidental?
Date 2011-08-02 19:29 +0900
Organization NEC Electronics
Message-ID <buo1ux4f6ob.fsf@dhlpc061.dev.necel.com> (permalink)
References <j18dm1$p66$1@speranza.aioe.org> <99psbmFaa6U6@mid.individual.net> <j18j47$6k7$1@speranza.aioe.org>

Show all headers | View raw


boltar2003@boltar.world writes:
>>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.

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.

This is in contrast with a function-call, where the parens are an
intrinsic part of the function-call syntax; the outermost pair of
parens in a function call are "special", which allows a special
interpretation of commas (directly) inside them.

It's like writing "int a = 1 + (2,3);" which is really just the same
as "int a = 1 + 3;".

-Miles

-- 
Laughter, n. An interior convulsion, producing a distortion of the features
and accompanied by inarticulate noises. It is infectious and, though
intermittent, incurable.

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