PREPROCESSOR(3) Library Functions Manual PREPROCESSOR(3)

KS_PASTE, KS_OPTIONALpreprocessor macros

#include <libks/preprocessor.h>

KS_PASTE(prefix, suffix);

KS_OPTIONAL(optional, fallback);

The preprocessor macros can be used to mitigate shortcomings of the C preprocessor.

The () macro concatenates prefix and suffix into a single token. Both arguments are macro expanded before being concatenated.

extern int KS_PASTE(unused_, __LINE__);

The () macro expands to optional if not empty, fallback otherwise. Both arguments are macro expanded. Intended to be used in conjunction with variadic macros in order to give the optional argument a default value.

KS_OPTIONAL(1, 0); /* 1 */
KS_OPTIONAL(, 0);  /* 0 */

Anton Lindqvist <anton@basename.se>

OpenBSD 8.0 September 1, 2026 PREPROCESSOR(3)