[C++0x] nullptr
Paolo Carlini
paolo.carlini@oracle.com
Thu May 6 21:07:00 GMT 2010
... another nit:
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr20.C
@@ -0,0 +1,17 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+// Test passing to ellipisis
+
+#include <cstdio>
+#include <cstring>
+
+int main()
+{
+ char buf1[64];
+ char buf2[64];
+
+ std::snprintf(buf1, sizeof(buf1), "%p", (void*)0);
+ std::snprintf(buf2, sizeof(buf2), "%p", nullptr);
+ return std::strcmp(buf1, buf2) != 0;
+}
this is not safe, I think, because non-C99 targets can miss snprintf in
<cstdio>.
Paolo.
More information about the Gcc-patches
mailing list