Revision: 666
http://assorted.svn.sourceforge.net/assorted/?rev=666&view=rev
Author: yangzhang
Date: 2008-04-20 07:57:51 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
updated macro test
Modified Paths:
--------------
sandbox/trunk/src/c/macros.c
Modified: sandbox/trunk/src/c/macros.c
===================================================================
--- sandbox/trunk/src/c/macros.c 2008-04-20 03:59:13 UTC (rev 665)
+++ sandbox/trunk/src/c/macros.c 2008-04-20 14:57:51 UTC (rev 666)
@@ -1,10 +1,16 @@
-// Demonstrates features of the standard C preprocessor.
+// Demonstrates features of the standard C preprocessor and the GCC
+// preprocessor extensions.
#include <stdio.h>
#define greet(x) printf("hello, " #x "!\n")
#define rename(x) x##_val_##x
+// GCC extensions.
+
+// Not really a preprocessor extension.
+#define dup(x,y) typeof(x) y = x;
+
int
main()
{
@@ -14,5 +20,11 @@
x_val_x = 0;
printf("%d\n", x_val_x);
+ char a = 'A';
+ dup(a,b);
+ b += 1;
+
+ printf("%c %c\n", a, b);
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|