Movatterモバイル変換


[0]ホーム

URL:


Issue 98 - WG21 CWG Issues
Title
Branching into try block
Status
tc1
Section
Clause [14] [except]
Submitter
Jack Rouse

Created on1999-02-23.00:00:00 last changed275 months ago

Messages

msg456 (view)
Date: 2020-12-15.00:00:00

Proposed resolution (10/00:

Change text in Clause 14 [except] paragraph 2 from:

Agoto,break,return, orcontinue statementcan be used to transfer control out of a try block or handler, but notinto one.
to:
Agoto orswitch statement shall not be usedto transfer control into a try block or into a handler.
[Example:
void f() {
  goto l1;  // Ill-formed
  goto l2;  // Ill-formed
  try {
    goto l1;  // OK
    goto l2;  // Ill-formed
    l1: ;
  } catch (...) {
    l2: ;
    goto l1;  // Ill-formed
    goto l2;  // OK
  }
}
end example ]
Agoto,break,return, orcontinuestatement can be used to transfer control out of a try block or handler.

(See alsoissue 246.)

msg169 (view)
Date: 2004-09-10.00:00:00

At the top of clause 15, in paragraph 2, it says:

Agoto,break,return, orcontinue statement can be used to transfercontrol out of a try block or handler, but not into one.
What aboutswitch statements?
    switch ( f() )    {    case 1:         try {             g();    case 2:             h();         }         catch (...)         {             // handler         }    break;    }
Daveed Vandevoorde:

Consider:

    void f() {        try {        label:            ;        } catch(...) {            goto label;        }    }
Now the phrase "try block" (without a hyphen) is used in paragraph1 in a way that causes me to think that it is not intended toinclude the corresponding handlers. On the other hand, the grammarentity "try-block" (with hyphen) does include the handlers.So is the intent to prohibit the above or not?
History
DateUserActionArgs
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetmessages: +msg456
2000-11-18 00:00:00adminsetstatus: ready -> dr
2000-05-21 00:00:00adminsetstatus: drafting -> ready
2000-02-23 00:00:00adminsetstatus: open -> drafting
1999-02-23 00:00:00admincreate

[8]ページ先頭

©2009-2025 Movatter.jp