I'm trying to define a C++ header file that accesses an array element defined in a macro.
The array is defined as:
#define NOZZLE_TO_PROBE_OFFSET { 27, 35, -1.5 }
I'm trying to access it like this, to obtain the first element:
#define Z_STEPPER_ALIGN_XY { { NOZZLE_TO_PROBE_OFFSET[0] , Y_BED_SIZE/2 }, { X_BED_SIZE, Y_BED_SIZE/2 } }
But I get the following error:
Marlin/src/gcode/calibrate/../../inc/../../Configuration_adv.h:659:57: error: expected '}' before '[' token
#define Z_STEPPER_ALIGN_XY { { NOZZLE_TO_PROBE_OFFSET[0] , Y_BED_SIZE/2 }, { X_BED_SIZE, Y_BED_SIZE/2 } }
~ ^
I'm having trouble remembering my macro expansion rules and also can't seem to summon the right google terms to help on this. The message makes sense but I'm not sure what to try as an alternative to represent array access. I suppose what I want the preprocessor to do is embed the array literal followed by the access, so that the output would expand to something like { 27, 35, -1.5 }[0] I appreciate the feedback on this admittedly n00by question!