Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/sys



On Tue, Oct 21, 2003 at 04:08:34AM -0500, Dave Huang wrote:
> On Tue, Oct 21, 2003 at 09:46:26AM +0100, David Laight wrote:
> > I don't believe that is valid portable C.
> 
> I don't have the standard around, but the comp.lang.c FAQ says it's fine:
> http://www.eskimo.com/~scs/C-faq/q5.6.html
> 
> > What about the comparison of function pointers?
> 
> Comparing them to NULL? That still works...

I've been in this game too long :-)
There used to be problems with systems that defined NULL with other
values - but that pre-dated ANSI C.

K&R2 says (A6.6) "An integral constant expression with value 0, or such an
expression cast to type void *, may be converted, by a cast, by assignment
or by comparison, to a pointer to any type."

So I stand corrected :-(
(execpt on the point of grammer in the lack of a ',' after the 'or'!)

        David

-- 
David Laight: david%l8s.co.uk@localhost



Home | Main Index | Thread Index | Old Index