Hi Sharath, This is from "http://www.faqs.org/faqs/C-faq/faq/" - <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> Now the issue is this , whether ((struct module*)0L)->persist_start will be referred as having pointer context or not. What I think is the second sentence of the c-faq stated above does'nt completely define the pointer context. It says that "initialization, assignment, or comparison" is a pointer context but it does not state that ((struct module*)0L) is not a pointer context ? What I think is that this statement in question is having a pointer context and the compiler can determine at the compile time that 0 is being used in the pointer context and hence the null-pointer. Please correct me if I am still wrong. I also thought the way you think but this confuses me a bit. -neeraj PS : Anybody having copy of the ANSI C-standard may throw some light on it pleasezzzzzzzz..... ! :) On Wed, 24 Apr 2002, Neeraj wrote: => Date: Wed, 24 Apr 2002 13:10:46 +0530 (IST) => From: Neeraj <neerajk@cse.iitk.ac.in> => To: "Sreedhar G (EIL)" <Sreedhar.G@eci.ericsson.se> => cc: kernelnewbies@nl.linux.org => Subject: RE: sys_init_module() => In-Reply-To: => <C115C1E71B07D51193A50008C7912330031FEECA@eindent005.in.ao.ericsson.se> => Message-ID: => <Pine.LNX.4.21.0204241257430.31902-100000@cselinux1.cse.iitk.ac.in> => MIME-Version: 1.0 => Content-Type: TEXT/PLAIN; charset=US-ASCII => => Well, I think I got the point why I was not able to convey the actual reason => behind that previous mail of mine. Please replace the NULL (in caps) to => null-pointer (as defined in the ANSI standard) at every place in the mail. So => it goes like this - => => As far as I remember, The C standard says that if a 0(zero) value is assigned to => a pointer or is type-casted to a pointer then it is converted to the => null-pointer (and not the #defined NULL). The value of the null-pointer is => arch/compiler dependent and cannot be guaranteed that it will be zero. The code => in module.c makes use of this point that it presumes that the value of null => pointer is zero. In my understanding the compiler interprets the code as: => => 1. (unsigned long)&((struct module *)0L)->persist_start // this parses to 2. => => 2. (unsigned long)&(null-pointer)->persist_start) // this parses to 3. => => 3. (unsigned long)&(value at address (null-pointer + offset of persist_start)) // this parses to 4. => => 4. (unsigned long)(0 + offset of persist_start) // and this gives the offset of => persist_start in the structure as null-pointer is considered to be zero. => => So, in this manner the null-pointer comes into play. Do correct me if I am wrong => in interpreting the things. Also, on second thoughts, is it specific to gcc in => any way such that gcc guarantees for every platform that the null-pointer (as => defined in the ANSI standard) will have a value 0(zero) ? Or the above method of => dereferencing will give the offset of the field in question ? => => -neeraj => => PS: I was a bit busy so could not post this query of mine with the required => corrections. => -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/