Wednesday, January 23, 2019

c - Expansion of module_param() macro: a struct with a single member or a bitfield?








The linux kernel module_param() macro expands into several instructions, some of them using numbers (sizes) that are calculated as follow (I only paste here relevant code):



sizeof(struct { int:- ! !(((00400|00040|00004)) < 0 || ((00400|00040|00004)) > 0777 || (((00400|00040|00004)) & 2)); })



Could somebody enlighten me what is that int:- ! !(NUMBER) doing?




Actually, I have several questions:
1) why define a struct with a single member?
2) why do not name that member? (or is the member's name... "int", just like the type?)
3) what is the meaning of that int:- ! !(NUMBER) expression? Is that a struct field? A bitfield?
4) what is the meaning and the final result of the above sizeof()?



Thank you very much.

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...