RE: sys_init_module()

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

 



=> > <snip>
=> >
=> > According to the language definition, a constant 0 in a pointer
=> > context is converted into a null pointer at compile time.That
=> > is, in an initialization, assignment, or comparison when one
=> > side is a variable or expression of pointer type, the compiler
=> > can tell that a constant 0 on the other side requests a null
=> > pointer, and generate the correctly-typed null pointer value.
=> >
=> > </snip>
=> 
=> <stuff deleted/>
=> 
=> > PS : Anybody having copy of the ANSI C-standard may throw some light on
=> > it pleasezzzzzzzz..... ! :)
=> 
=> I don't have the ANSI C spec, but I'm going to assume that it agrees with
=> K&R on this (yeah, I know.  I should never assume).
=> 
=> K&R (2nd edition) explicitly state that the null pointer and the integer
=> "0" are interchangeable.

So, what would be your inference in the case of architectures where the null
pointer is not designated by 0(zero) (lot of them are mentioned there on the
C-faq page). What would then ((struct a *)0L)->field refer to and how will the
compiler know that (null-pointer)->field is required to evaluate the offset of
field in the structure "a" ? 

Any suggestions or hints are welcome. :) 

Thanks
-neeraj 

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