mercredi 25 mars 2020

How does the C preprocessor go from a macro to a struct definition

As I was searching for a way to do reflection in C, I found this answer https://stackoverflow.com/a/31908340/6784916.

In his answer, he refers to the metaresc library and he shows an example how to use it:

TYPEDEF_STRUCT (point_t,
                double x,
                double y
                );

int main (int argc, char * argv[])
{
  point_t point = {
    .x = M_PI,
    .y = M_E,
  };

How does the preprocessor go from the above macro call to a struct definition?





Aucun commentaire:

Enregistrer un commentaire