This is the mail archive of the gcc-patches@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: Patch: New null_terminated attribute for C/C++


Tom Tromey wrote:
Isn't calling exec("foo", "bar", NULL) from C++ is an error, because
NULL is 0?  Suppose sizeof(int)!=sizeof(char*).  Then the 0 will be
the wrong width.  Or is NULL in C++ guaranteed to be a pointer-width 0?
It is, for any sane compiler, including G++.  Actually, NULL in G++ is
a magic __null constant, but the same applies.

I think we should allow exec("foo", "bar", NULL), without a warning.
Certainly for C we must, to avoid too many spurious warnings for
long-working and in practice portable code.  For C++ I also think
we should allow it without warning, as it is portable given a sane
definition of NULL.
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


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