🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2685

function try block

#2685
From: Avner Ben
Date: Tue, 21 Nov 1995 20:47
35 lines
1742 bytes
The April DWG mentions, in the chapter on exception handling, a creature named
__function-try-block__. The idea, if I get it right, is to allow the constructor
of an assembly class to properly handle exceptions that might occur in the
constructors of its contained objects. Without this refinement (if the try block 
is inside the ctor function block) the local handlers  will not catch it - only 
handlers of the block that tried to create the object. 
I think this is a great idea. Unfortuantely, the DWG refrains from bringing examples, and I am not sure I could read the BNF precisely. Does 

	function-try-block:
		try ctor-initializer-opt function-body handler-seq

mean the following crazy piece of code?

	FileOfRecords::FileOfRecords(const char* name, int size)
	 try {	
	 : m_file(name), m_buffer(size)
	{ 
		// do stuff
	} catch(...) {
		// handle error
	}

			Avner Ben avnerben@netvision.net.il


[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <48tdsi$5o4@engnews1.eng.sun.com>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: Avner Ben <avnerben@netvision.net.il>
Newsgroups: comp.std.c++
Subject: function try block
Date: 21 Nov 1995 20:47:14 GMT
Organization: ?
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <48tdsi$5o4@engnews1.eng.sun.com>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
To: "'std-c++@ncar.ucar.edu.'" <std-c++@ncar.ucar.edu>
X-Lines: 31
Content-Length: 935
Originator: clamage@taumet