CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
String Literal Macros

Create static strings from compile-time constants. More...

Macros

#define _S
 Creates a static ASCII string from a string literal.
 
#define _SU
 Creates a static UTF-8 string from a string literal.
 
#define _SO
 Creates a static string with other/unknown encoding from a literal.
 

Detailed Description

Create static strings from compile-time constants.

These macros convert C string literals into CX string objects by prepending a minimal header. The strings are static and don't need to be destroyed. They cannot be modified (attempts to modify will cause a copy).

Choose the appropriate macro based on content:

Example:

string s1 = _S"Hello"; // ASCII literal
string s2 = _SU"Hello 世界"; // UTF-8 literal
strDup(&s1, _S"World"); // Can use in any string function
void strDup(strhandle o, strref s)
#define _SU
Creates a static UTF-8 string from a string literal.
Definition strbase.h:397
#define _S
Creates a static ASCII string from a string literal.
Definition strbase.h:392