This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: New GCC extension hint
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: tringi at mx-3 dot cz
- Cc: gcc at gnu dot org
- Date: Sun, 04 Jan 2004 16:42:09 -0500 (EST)
- Subject: Re: New GCC extension hint
- References: <005f01c3d308$d2b5e140$ad5a6cc2@merovingian>
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