Provide definitions to initialize const variables and arrays in stub_..._user.h #1

Closed
opened 2025-11-27 15:59:55 +01:00 by efelon · 0 comments
Owner

In stub.c:

const type variable[number] = CONST_variable_INIT;

In stub_....h (stub_..._user.h is included before stub_....h):

ifndef CONST_variable_INIT
    #define CONST_variable_INIT = { 0 }
endef

In stub_..._user.h (if required):

#define CONST_variable_INIT = { t, e, s, t, r, e, l, a, t, e, d }
In `stub.c`: ``` const type variable[number] = CONST_variable_INIT; ``` In `stub_....h` (`stub_..._user.h` is included before `stub_....h`): ``` ifndef CONST_variable_INIT #define CONST_variable_INIT = { 0 } endef ``` In `stub_..._user.h` (if required): ``` #define CONST_variable_INIT = { t, e, s, t, r, e, l, a, t, e, d } ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: efelon/stubser#1