Closed sammy-tri closed 4 years ago
Does 'using' work for free functions? It doesn't appear to...
I didn't remember if using
would work for that. In that case
#ifdef USE_ETHERNET
#define SdkGetAngularPosition Ethernet_GetAngularPosition
#else
#define SdkGetAngularPosition GetAngularPosition
#endif
would work instead.
Tried something similar to your suggestion. Surprisingly (to me) the preprocessor/compiler really wanted me to use macros with arguments.
USB/Ethernet switching is being handled in much the same way we handle ROS1/ROS2 build switching, so I don't think it's too bad of a hack. I would say that
MAYBE_ETHERNET(Function(args))
does look a bit odd, and I'd generally say macros that look function-like but aren't are potentially confusing. Based on what we did with the ROS1/ROS2 handling, would it be better to do something likeso that USB/Ethernet-specific switches all occur in one place and then there aren't macro invocations all over?