This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New GCC extension hint


Hi Jan,

> Main idea is this:
> 
> __VALUE__(var, style)
> 
> Where __VALUE__ acts like macro that examines variable "var"
> and returns styled string.

Not exactly the same as your definition of __VALUE__, but would the
following work for you?

#include <stdio.h>

#define STRINGIFY(X) #X

#define SHOW_VAR(X) printf ("%s = %d\n", STRINGIFY(X), (X))

int
main ()
{
  int a = 123;
  SHOW_VAR (a);
  return 0;
}

Kazu Hirata


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]