diff -r aa0d09f2d81c -r 380bd45bc94a src/cx/string.h --- a/src/cx/string.h Sun Apr 16 21:35:08 2023 +0200 +++ b/src/cx/string.h Mon Apr 17 21:47:34 2023 +0200 @@ -129,6 +129,18 @@ */ typedef struct cx_strtok_ctx_s CxStrtokCtx; +#ifdef __cplusplus +extern "C" { + +/** + * A literal initializer for an UCX string structure. + * + * @param literal the string literal + */ +#define CX_STR(literal) cxstring{literal, sizeof(literal) - 1} + +#else // __cplusplus + /** * A literal initializer for an UCX string structure. * @@ -136,10 +148,8 @@ * * @param literal the string literal */ -#define CX_STR(literal) {literal, sizeof(literal) - 1} +#define CX_STR(literal) (cxstring){literal, sizeof(literal) - 1} -#ifdef __cplusplus -extern "C" { #endif