开发者

Understanding #define #ifdef and Macros in the Linux Kernel

开发者 https://www.devze.com 2023-04-12 05:28 出处:网络
I have just started work on auditing the Linux kernel and I cant help but notice in the source code the multitude of #defines and #ifdefs. I cant seem to understand exactly how these are being used. I

I have just started work on auditing the Linux kernel and I cant help but notice in the source code the multitude of #defines and #ifdefs. I cant seem to understand exactly how these are being used. I have checked the web but the descriptions I have found seem awfully vague. Can any one enlighten me as to what exactly #defines and the like do and why they are used? A brief explanation is all I need for now.

Further more开发者_运维技巧, people speak of macros a lot on different sources I have looked at. I have absolutely no clue what they are talking about and again as before any description I have found on the web have been equally as cryptic. Can someone please explain macros to me? How they are defined and why they are used so frequently (apparently for all I know) in the Linux kernel.

Any help would be much appreciated.


I looked further into my previous question and found that I needed to look into the C preprocessor for the answer. A lecturer menutioned that the preprocessor expands the macros and so I followed it up. Here is the link for anyone else interested into the meaning behind macros etc. the c preprocessor hope it helps some other lost soul :)

0

精彩评论

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