This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++0x] nullptr
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Magnus Fromreide <magfr at lysator dot liu dot se>, gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Thu, 06 May 2010 23:07:07 +0200
- Subject: Re: [C++0x] nullptr
- References: <1268546192.2028.32.camel@sara.home> <4BA46E77.6080507@redhat.com> <1269813166.2249.8.camel@sara.home> <4BB12B74.80703@redhat.com> <4BDD0915.2020301@redhat.com> <1272842221.2000.26.camel@sara.home> <4BE32BEA.9010208@redhat.com>
... 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.