Skip to contentSkip to conversation

cpu_*(), #define, and &

DISCUSSION George Dunlap 2 participants 2 messages Sep 21, 2009

lore
Share & tools
lore
#0 lore raw

I hope I'm not bikeshedding here
(http://catb.org/jargon/html/B/bikeshedding.html), but I'm not really happy with the cpu_*() macros in cpumask.h adding ampersands before the arguments. In C (as opposed to C++), passing a non-pointer generally means that no values are going to be changed. Other than Linux similarity, is there a good reason to do this in a macro, rather than just having the caller provide the &? Would anyone object to me submitting a patch to change that?

(A patch to change it looks to be rather big and boring, so I want to talk about it first before doing it...)

-George

#1 lore raw
Quoted 11 lines · George Dunlap

I hope I'm not bikeshedding here
(http://catb.org/jargon/html/B/bikeshedding.html), but I'm not really happy with the cpu_*() macros in cpumask.h adding ampersands before the arguments. In C (as opposed to C++), passing a non-pointer generally means that no values are going to be changed. Other than Linux similarity, is there a good reason to do this in a macro, rather than just having the caller provide the &? Would anyone object to me submitting a patch to change that?

(A patch to change it looks to be rather big and boring, so I want to talk about it first before doing it...)

I somewhat agree about the pointless macro-ification in cpumask.h, but I don't care enough about this to diverge from the original Linux definitions. The cpumask macros which modify the given mask are named to make it pretty obvious. We'll live with it; it's not really that annoying.

-- Keir