开发者

Function declaration instead of comment

开发者 https://www.devze.com 2022-12-28 20:27 出处:网络
I noticed that in the Linux kernel 2.4 file sched.c there\'s a line that says: void scheduling_functions_start_here(开发者_StackOverflow中文版void) { }

I noticed that in the Linux kernel 2.4 file sched.c there's a line that says:

void scheduling_functions_start_here(开发者_StackOverflow中文版void) { }

and one that says

void scheduling_functions_end_here(void) { }

Shouldn't this kind of stuff be written as a comment? What is the gain of using functions?


Ok, I just did some googling, and can now somewhat back up my comment. Check out process.c, line 439 onwards.

I don't read C too well, but it looks like it needs to check whether a thread is in a scheduling function or not.


I'm not a Linux kernel author, but the most likely answer is that function names are more likely to appear in an IDE's file index than comments are.

0

精彩评论

暂无评论...
验证码 换一张
取 消