Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66893 - trunk/boost/detail
From: bdawes_at_[hidden]
Date: 2010-11-30 09:48:07


Author: bemandawes
Date: 2010-11-30 09:48:03 EST (Tue, 30 Nov 2010)
New Revision: 66893
URL: http://svn.boost.org/trac/boost/changeset/66893

Log:
Add lightweight std::exception catching main, dependent only upon <iostream> and <exception>
Added:
   trunk/boost/detail/main.hpp (contents, props changed)

Added: trunk/boost/detail/main.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/detail/main.hpp 2010-11-30 09:48:03 EST (Tue, 30 Nov 2010)
@@ -0,0 +1,36 @@
+// boost/detail/main.hpp -------------------------------------------------------------//
+
+// Copyright Beman Dawes 2010
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <iostream>
+#include <exception>
+
+//--------------------------------------------------------------------------------------//
+// //
+// exception reporting main() that calls cpp_main() //
+// //
+//--------------------------------------------------------------------------------------//
+
+int cpp_main(int argc, char* argv[]);
+
+int main(int argc, char* argv[])
+{
+ try
+ {
+ return cpp_main(argc, argv);
+ }
+
+ catch (const std::exception& ex)
+ {
+ std::cout
+ << "\nERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR\n"
+ << "\n****************************** std::exception *****************************\n"
+ << ex.what()
+ << "\n***************************************************************************\n"
+ << std::endl;
+ }
+ return 1;
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk