I would like a detailed explanation of what SPARK_NO_PREPROCESSOR does

I’m implementing a custom SdFat class I created, and to do that I need to disable the preprocessor. However, once I do that I start getting a whole host of other issues. From what I can tell, the compiler no longer realizes that I am declaring functions after I try to use them in the code. For example, I create a Timer object that calls writeBulkData(), which I define later in my code. The code runs fine normally, but if I disable the preprocessor I get errors saying I haven’t declare several functions. If I move the declarations up, most of the errors go away.

Regardless, can someone tell me what the preprocessor does, and what are the implications of disabling it?

With the preprocessor disabled you need to include “Particle.h” and adhere to the C/C++ coding standards.
This particularly means that you have to implement a function before first use or (more common) have function prototypes/forward declarations.

This is what the preprocessor otherwise does for you.

1 Like