Remix.run Logo
AdieuToLogic 5 days ago

Where C macros provide functionality C++ classes and/or templates cannot is stringification of their argument(s).

For example:

  #include <iostream>

  #define SQL(statement) #statement

  int main (int ac, const char *av[])
  {
   const char *select = SQL(select * from some_table);

   std::cout << select << std::endl;

   return 0;
  }