2
0
mirror of https://github.com/boostorg/test.git synced 2026-01-25 06:42:22 +00:00
Files
test/example/prg_exec_example.cpp
Gennadiy Rozental 04e7b4dada 1.30.beta1
[SVN r18733]
2003-06-09 09:28:19 +00:00

20 lines
698 B
C++

// (C) Copyright Gennadiy Rozental 2001-2003.
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied warranty,
// and with no claim as to its suitability for any purpose.
//
// See http://www.boost.org for most recent version including documentation.
int add( int i, int j ) { return i+j; }
int cpp_main( int, char *[] ) // note the name!
{
// two ways to detect and report the same error:
if ( add(2,2) != 4 ) throw "Oops..."; // #1 throws on error
return add(2,2) == 4 ? 15 : 1; // #2 returns error directly
}
// EOF