Derive-C
Loading...
Searching...
No Matches
def.h File Reference
Include dependency graph for def.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NAME   derive_c_parameter_self
 Supporting templates that internally invoke new templates.
#define SELF   NAME

Macro Definition Documentation

◆ NAME

#define NAME   derive_c_parameter_self

Supporting templates that internally invoke new templates.

Ideally we could do:

#define SELF foo
// within the template
#pragma push_macro("SELF")
#define SELF NS(SELF, internal_vector)
// ...
// ...
#pragma pop_macro("SELF")
// The rest of the structure definition ...

However, this is not possible, as macros are not eagrely expanded at definition

  • We cannot 'save' a macro, and redefine it in using its previous/saved value

To solve this, there are a few options

  1. For the user to provide names for internally used data structures
  2. A more complex scheme of stacking internal names (name 1, 2, etc)
  3. Namespace all macro paramaters (e.g. VECTOR_SELF, HASHMAP_SELF etc)

To keep code simple, but allow definitions to uniformly use SELF:

  • We restrict to 1 layer deep - NAME (from user), and INTERNAL_NAME (usage inside a template file, one layer deep).

Definition at line 50 of file def.h.

◆ SELF

#define SELF   NAME

Definition at line 51 of file def.h.