From: Rusty Russell <rusty@rustcorp.com.au>
To: Nikanth Karthikesan <knikanth@novell.com>
Cc: nikanth@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: Strange code in include/linux/cpumask.h
Date: Thu, 26 Mar 2009 09:14:46 +1030 [thread overview]
Message-ID: <200903260914.46958.rusty@rustcorp.com.au> (raw)
In-Reply-To: <200903251214.31731.knikanth@novell.com>
On Wednesday 25 March 2009 17:14:30 Nikanth Karthikesan wrote:
> On Wednesday 25 March 2009 10:41:11 Rusty Russell wrote:
> > Yes, except that this insists that bitmap be an unsigned long * or you'll
> > get a warning. Otherwise the macro could be used on anything. And it
> > needs to be a macro to use it as a static initializer.
>
> Ah, got it. Thanks a lot for the explanation. May be a comment could be added
> to the source.
Well, it's not that unusual a trick in the kernel, but an explanation might
help.
> Also looks like, this is not being used as a static initializer anywhere.
> i.e., Using my type-checking only version didn't trigger any error/warnings!
It will. cpu_all_mask uses to_cpumask, and it's replacing CPU_MASK_ALL.
> Being a deprecated interface, no new users are expected? Or is gcc smart, not
> complaining when used as static initializer, as it would always evaluate to
> (struct cpumask *)(bitmap)?
Yes, it seems to be. AFAICT though, using a function in an initializer is not
valid C.
> Can the sizeof constification be removed?
Possibly, but it makes me nervous to rely on it.
Thanks,
Rusty.
>
> Thanks
> Nikanth
>
next prev parent reply other threads:[~2009-03-25 22:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 4:51 Strange code in include/linux/cpumask.h Nikanth Karthikesan
2009-03-25 5:11 ` Rusty Russell
2009-03-25 6:44 ` Nikanth Karthikesan
2009-03-25 22:44 ` Rusty Russell [this message]
2009-03-26 4:12 ` Nikanth Karthikesan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200903260914.46958.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=knikanth@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nikanth@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.