Re: Mixed questions

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

 



Hello Gabor,

Tuesday, April 13, 2004, 4:26:24 PM, you wrote:

GF> 2. Why is the "{ }" needed?
GF> #define __pgd(x) ((pgd_t) { (x) } )

It casts unsigned long/unsigned long long to pgd_t type which models pgdir entry. There is no such
thing in C89/90
standart. Normally a struct isnt casted to other types and vice versa. That is, It is an extension. Linux kernel
exploits gcc's nonstandart properties frequently.

         #define __pte(x)        ((pte_t) { (x) } )
First of all, a compound statement is used.(Extension) -> { } Then the return value is casted to
desired type. Still a cast from any types to struct types is not standard, which it is used here...

-- 
Bora Sahin
borasahin.port5.com


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