Derive-C
Loading...
Searching...
No Matches
scope.h File Reference

Go to the source code of this file.

Macros

#define DC_SCOPED(type)
 RAII in C. Call the destructor when the variable goes out of scope.
#define DC_DEFER(fcn)

Functions

 DC_ZERO_SIZED (sentinel)
 Simple zero sized value for DC_DEFER.

Macro Definition Documentation

◆ DC_DEFER

#define DC_DEFER ( fcn)
Value:
__attribute__((cleanup(fcn))) sentinel PRIV(NS(sentinel, __COUNTER__)) = {}
#define NS(pre, post)
Definition namespace.h:4
#define PRIV(name)
Definition namespace.h:6

Call the function with a null 'sentinel' value.

  • Useful for cleanup that does not take arguments

Definition at line 12 of file scope.h.

◆ DC_SCOPED

#define DC_SCOPED ( type)
Value:
__attribute__((cleanup(type##_delete))) type

RAII in C. Call the destructor when the variable goes out of scope.

Definition at line 5 of file scope.h.

Function Documentation

◆ DC_ZERO_SIZED()

DC_ZERO_SIZED ( sentinel )

Simple zero sized value for DC_DEFER.