Derive-C
Loading...
Searching...
No Matches
namespace.h
Go to the documentation of this file.
1#pragma once
2
3#define _DC_NS_EXPANDED(pre, post) pre##_##post
4#define DC_EXPAND(...) __VA_ARGS__
5#define DC_STRINGIFY(MACRO) #MACRO
6#define DC_EXPAND_STRING(NAME) DC_STRINGIFY(NAME)
7
8#define DC_IS_DEFINED(MACRO) (sizeof(DC_STRINGIFY(MACRO)) != sizeof(#MACRO))
9
10// JUSTIFY: Not namespaced under `DC`
11// - `NS` is everywhere - ugly if expanded to DC_NS, and not a name likely to
12// conflict with others
13// - Same rationale for PRIV
14#define NS(pre, post) _DC_NS_EXPANDED(pre, post)
15
16// JUSTIFY: private by namespacing
17// - There is no easy way to mark private in C
18// - This makes it obvious, and furthermore prefix keeps it at the bottom of intellisense
19// suggestions
20#define PRIV(name) NS(__private, name)
21
22// JUSTIFY: Marking public functions
23// - When a template is expanded, not all of the methods are used by the user
24// - Use of static means unused warnings occur
25#define DC_PUBLIC [[maybe_unused]]
26
27// JUSTIFY: Marking public functions
28// - When a template is expanded, not all of the methods are used by the user
29// - Use of static means unused warnings occur
30#define DC_INTERNAL [[maybe_unused]]