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++


Fergus Henderson wrote:
If foo() is a varargs function that expects its argument list to be
terminated by a null pointer, and the user writes
	
	foo(..., NULL);

then this code will do the wrong thing on some platforms, and so the
compiler should warn about it.
The conclusion I got from the discussion was that there does not
exist any such platform supported for Gcc where the wrong thing will
happen, nor is there likely to be, assuming NULL is defined as a magic
__null, as it is for G++.

I consider foo (..., (T *) NULL) to be an ugly and pointless redundancy.
But then I'm used to languages where nil or null is a "generic null
pointer".
--
	--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]