Skip to content

Preprocessor

子悦解说 edited this page Jan 31, 2025 · 1 revision

Warning

Preprocessor is a dangerous feature which breaks your program easily when you use it unproperly.

Using it without proper knowledge is highly discouraged.

Preprocessor is a new feature introduced in v1.135.

Features

Feature Description
#pragma no_macro Disabling preprocessor in further compiling. This is not undoable.
#pragma message <text> Sending a message to the compiler's standard output stream. The <text> must be enclosed with quotes.
#error <text> Throwing a compilation error. The <text> must be enclosed with quotes.
#define <name> <value> Defining an object-like macro string replacement. The <name> is required and <value> is optional.
#undef <name> Undefining a macro. The <name> is required.
#ifdef <name> Whether a macro has been defined.
#ifndef <name> Whether a macro has not been defined.
#if_ <condition> Self-explanatory.
#elseif_ <condition> Self-explanatory.
#else_ Self-explanatory.
#endif_ Self-explanatory.

Predefined macros

Macro Description Example
__DEBUG__ Whether the program is being compiled in debug mode. True
__VERSION__ Integer-style version number of the engine. 1135
__DATE__ Compiling date. "1 Feb 2025"
__TIME__ Compiling time. "18:16:15"
__LINE__ Line number. 24
Clone this wiki locally