Compile-Time Code Inclusion or Exclusion

I’m following an RTOS book that explicitly includes or excludes code

If they are functions, you don’t need to do anything.

based on the configuration variables set through #define variables.
I am going to have to take a different approach.

Compile-time toggles can be passed through build options:

IIUC they are comptime values so you could use conditional
on the blocks and only one branch will be compiled.

If you can post an concrete example it’d be easier
to discuss approaches though.

2 Likes