Fwd: How is NULL pointer dereference handled inside kernel?

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

 



---------- Forwarded message ----------
From: Nish Aravamudan <nish.aravamudan@xxxxxxxxx>
Date: Wed, 17 Nov 2004 22:36:42 -0800
Subject: Re: How is NULL pointer dereference handled inside kernel?
To: Kishore A K <kishoreak@xxxxxxxxx>


Kishore,

On Thu, 18 Nov 2004 11:49:50 +0530, Kishore A K <kishoreak@xxxxxxxxx> wrote:
> I remember a big discussion happening on LKML on this
> topic (i.e., NULL vs 0) a couple of months back. It must
> be still available in their mail archives. Try googling for
> "Use NULL instead of integer 0" & you must find it. Must
> say it was a pretty heated discussion. Dont know what
> the outcome was. I stopped following it after sometime.for the pointer.

Thanks for the pointer. I found the thread at, for others' reference:
http://lkml.org/lkml/2004/7/7/181 . Very interesting. Conclusion?:
Linus' final word is that NULL is a pointer and 0 is an integer (even
though K&R disagrees). Thus, the "official" Linux coding style
(especially for new code, but also applies to how old code *should*
be) would be to use NULL when assigning pointers and not 0. If nothing
else, this makes things type-clear (e.g., parameters); if that's not
good enough for you, it makes things clear period :)

-Nish


-- 
"Dream as if you'll live forever; Live as if you'll die today."

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux