Use a variable before it's declaration

Rock Lee rocklee_104 at outlook.com
Thu Sep 10 03:09:42 EDT 2015


Hi, all:
	Here is a snippet of linux-v3.4 which drives me crazy.
Because init_task hasn't been declared yet when init_thread_union is 
initializing. Why is there no compiling error? Any hint would be helpful.

union thread_union init_thread_union __init_task_data = 

     { INIT_THREAD_INFO(init_task) }; 

 

/* 

  * Initial task structure. 

  * 

  * All other task structs will be allocated on slabs in fork.c 

  */ 

struct task_struct init_task = INIT_TASK(init_task);


-- 
Rock Lee



More information about the Kernelnewbies mailing list