Created on1999-02-23.00:00:00 last changed275 months ago
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() {—end example ]
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
}
}
Agoto,break,return, orcontinuestatement can be used to transfer control out of a try block or handler.
(See alsoissue 246.)
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 | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2003-04-25 00:00:00 | admin | set | status: dr -> tc1 |
| 2000-11-18 00:00:00 | admin | set | messages: +msg456 |
| 2000-11-18 00:00:00 | admin | set | status: ready -> dr |
| 2000-05-21 00:00:00 | admin | set | status: drafting -> ready |
| 2000-02-23 00:00:00 | admin | set | status: open -> drafting |
| 1999-02-23 00:00:00 | admin | create | |