cbase 1.46.11
C/C++ Static Template
Loading...
Searching...
No Matches
String Macros

Macros

#define STR8(s)
 Wraps a C string literal into a String8 struct at compile time.
#define STR8_FMT(s)
 Helper macro to use a String8 in a printf-style format string. Example:

Detailed Description

Macro Definition Documentation

◆ STR8

#define STR8 ( s)
Value:
((String8){.str = (u8 *)(s), .size = sizeof(s) - 1})
uint8_t u8
Definition base_types.h:22
A sized UTF-8 string slice.

Wraps a C string literal into a String8 struct at compile time.

Warning
Only pass actual string literals ("..."), NOT pointers!
Parameters
sThe string literal.

Definition at line 59 of file base_strings.h.

◆ STR8_FMT

#define STR8_FMT ( s)
Value:
(int)(s).size, (char *)(s).str

Helper macro to use a String8 in a printf-style format string. Example:

String8 name = STR8("World");
printf("Hello %.*s!\n", STR8_FMT(name));
#define STR8_FMT(s)
Helper macro to use a String8 in a printf-style format string. Example:
#define STR8(s)
Wraps a C string literal into a String8 struct at compile time.

Definition at line 69 of file base_strings.h.