Skip to content
Snippets Groups Projects
Commit 080e3aa0 authored by Per Hedbor's avatar Per Hedbor
Browse files

Added support for dynamic compile-time macros.

Some simple examples;

> master()->add_predefine("RND()", lambda( string arg1 ) { return random((int)arg1); });
> RND(10);
(2) Result: 9
> cpp("RND(123)")
(3) Result: "19"

It can also be used to override the default builtin macros. If you
want "fun" debug information (not used for backtraces, but code using
__LINE__ will be confused):

> master()->add_predefine("__LINE__", lambda() { return random(4711); });
> __LINE__;
(6) Result: 2593
> __LINE__;
(7) Result: 1780
parent b2f5ff9b
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment