This past week, I encountered a super interesting problem while working with C++ at Google. On a day to day basis, most of the software I deal with is written with C++ and an internal configuration language known as GCL. This week, I was working on a fairly significant migration using an internal API when I encountered a fascinating problem that exposed me to the madness of C++ macros.
Allow me to set the stage.
Pretend that this API contains an APIFactory
class, and that there exist two C++ macros to declare instances of APIFactory
. Here…