A Curious Case of C++ Macros at Google

Alvin Lin
6 min readMar 29, 2020

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…

--

--

Alvin Lin

I'm a software engineer from New York City with a permanent case of bed hair.