Changing between sets of parameters before compilation without manually messing with comments

The game I’m working on communicates with some electronics.

I do some calculations on the computer, based on parameters of the electronics.

I’m looking for a good way to be able to easily switch between versions.

The simplest way would probably to use ifs, but I worry about the performance as more places which require this solution are added, and I worry that even if I use some consts I can change before I compile, the ifs still might not get compiled away (I couldn’t find anything confirming all if(const) get compiled to without the condition)

Another thought I had was to use a preprocessor directive, and use an editor script to add a preprocessor directive automatically based on which case I’m interested in.

I’m wondering if an even better solution exists out there.

Performance is likely to not be your concern.

Making a mess of your code is far more likely.

Instead, use something like an interface or base class to abstract the different configurations if you want to do it at runtime.

Preprocessor directives are not runtime. They actually modify what code is included, so they are a completely different solution to the same problem. Either approach is valid.