Re: Use a variable before it's declaration

2015-09-10 Thread Rock Lee
> Sure. That's a completely different issue. But this works: > > extern int b; > int *a = &b; > int b = 20; > > int main(void) > { > return 0; > } > > and that's what the code you refer do does. Yes, that make sense, thanks very much :-) -- Rock Lee ___

Re: Use a variable before it's declaration

2015-09-10 Thread Rock Lee
On 2015/9/10 15:55, valdis.kletni...@vt.edu wrote: > On Thu, 10 Sep 2015 15:09:42 +0800, Rock Lee said: > >> union thread_union init_thread_union __init_task_data = >> >> { INIT_THREAD_INFO(init_task) }; > > 'gcc -E' to see what this expands to. All may not be as it seems. :) > Thanks, I us

Re: Use a variable before it's declaration

2015-09-10 Thread Bjørn Mork
Rock Lee writes: >> Rock Lee writes: >> >>> 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 in

Re: Use a variable before it's declaration

2015-09-10 Thread Rock Lee
> Rock Lee writes: > >> 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_tas

Re: Use a variable before it's declaration

2015-09-10 Thread Bjørn Mork
Rock Lee writes: > 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

Re: Use a variable before it's declaration

2015-09-10 Thread Valdis . Kletnieks
On Thu, 10 Sep 2015 15:09:42 +0800, Rock Lee said: > union thread_union init_thread_union __init_task_data = > > { INIT_THREAD_INFO(init_task) }; 'gcc -E' to see what this expands to. All may not be as it seems. :) pgpbElrwkwUP7.pgp Description: PGP signature _

Use a variable before it's declaration

2015-09-10 Thread Rock Lee
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(