Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
someCFunc.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
11 #include "Teuchos_Assert.hpp"
12 
13 
14 extern "C" {
15 
16 
17 int someCFunc(int input, int *ierr)
18 {
19  int output = -1;
20  TEUCHOS_CWRAPPER_TRY(ierr) {
21  TEUCHOS_ASSERT_INEQUALITY(input, >=, 0);
22  if (input > 10) {
24  }
25  else {
26  output = input;
27  }
29  return output;
30 }
31 
32 
33 } // extern "C"
#define TEUCHOS_CWRAPPER_TRY(IERR)
Define a try block.
#define TEUCHOS_CWRAPPER_SET_ERROR_CODE(IERR, IERR_VALUE)
Set the error code.
#define TEUCHOS_CWRAPPER_CATCH_ERROR_CODE(IERR)
Define the catch blocks and set the error code.
#define TEUCHOS_ASSERT_INEQUALITY(val1, comp, val2)
This macro is checks that an inequality between two numbers is satisified and if not then throws a go...
int someCFunc(int input, int *ierr)
Definition: someCFunc.cpp:17