SimGrid  3.18
Versatile Simulation of Distributed Systems

Detailed Description

Exceptions support (C)

Those fonctions are used to throw C++ exceptions from C code. This feature should probably be removed in the future because C and exception do not exactly play nicely together.

Classes

struct  xbt_ex
 A legacy exception. More...
 

Macros

#define THROW(c, v)
 Builds and throws an exception. More...
 
#define THROWF(c, v, ...)
 Builds and throws an exception with a printf-like formatted message. More...
 
#define THROW_IMPOSSIBLE   THROWF(unknown_error, 0, "The Impossible Did Happen (yet again)")
 Throw an exception because someting impossible happened. More...
 
#define THROW_UNIMPLEMENTED   THROWF(unknown_error, 0, "Function %s unimplemented",__func__)
 Throw an exception because someting unimplemented stuff has been attempted. More...
 
#define THROW_DEADCODE   THROWF(unknown_error, 0, "Function %s was supposed to be DEADCODE, but it's not",__func__)
 Throw an exception because some dead code was reached. More...
 
#define DIE_IMPOSSIBLE   xbt_die("The Impossible Did Happen (yet again)")
 Die because something impossible happened. More...
 

Enumerations

enum  xbt_errcat_t {
  unknown_error = 0, arg_error, bound_error, mismatch_error,
  not_found_error, system_error, network_error, timeout_error,
  cancel_error, thread_error, host_error, tracing_error,
  io_error, vm_error
}
 Categories of errors. More...
 

Functions

const char * xbt_ex_catname (xbt_errcat_t cat)
 Get the name of a category. More...
 

Macro Definition Documentation

◆ THROW

#define THROW (   c,
 
)

Builds and throws an exception.

◆ THROWF

#define THROWF (   c,
  v,
  ... 
)

Builds and throws an exception with a printf-like formatted message.

◆ THROW_IMPOSSIBLE

#define THROW_IMPOSSIBLE   THROWF(unknown_error, 0, "The Impossible Did Happen (yet again)")

Throw an exception because someting impossible happened.

◆ THROW_UNIMPLEMENTED

#define THROW_UNIMPLEMENTED   THROWF(unknown_error, 0, "Function %s unimplemented",__func__)

Throw an exception because someting unimplemented stuff has been attempted.

◆ THROW_DEADCODE

#define THROW_DEADCODE   THROWF(unknown_error, 0, "Function %s was supposed to be DEADCODE, but it's not",__func__)

Throw an exception because some dead code was reached.

◆ DIE_IMPOSSIBLE

#define DIE_IMPOSSIBLE   xbt_die("The Impossible Did Happen (yet again)")

Die because something impossible happened.

Enumeration Type Documentation

◆ xbt_errcat_t

Categories of errors.

This very similar to std::error_catgory and should probably be replaced by this in the future.

Enumerator
unknown_error 

unknown error

arg_error 

Invalid argument.

bound_error 

Out of bounds argument.

mismatch_error 

The provided ID does not match.

not_found_error 

The searched element was not found.

system_error 

a syscall did fail

network_error 

error while sending/receiving data

timeout_error 

not quick enough, dude

cancel_error 

an action was canceled

thread_error 

error while [un]locking

host_error 

host failed

tracing_error 

error during the simulation tracing

io_error 

disk or file error

vm_error 

vm error

Function Documentation

◆ xbt_ex_catname()

const char* xbt_ex_catname ( xbt_errcat_t  cat)

Get the name of a category.

Get the name of a category.