From: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
To: Sagi Grimberg
<sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH RFC] IB/core, cma: Nice log-friendly string helpers
Date: Mon, 11 May 2015 09:50:46 +0200 [thread overview]
Message-ID: <55505F56.4030907@sandisk.com> (raw)
In-Reply-To: <554F36BC.5070009-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
On 05/10/15 12:45, Sagi Grimberg wrote:
> On 5/10/2015 1:29 PM, Bart Van Assche wrote:
>> On 05/10/15 12:04, Sagi Grimberg wrote:
>>> +#define IB_EVENT(event) \
>>> + ((event) < ARRAY_SIZE(ib_events) ? \
>>> + ib_events[(event)] : "UNRECOGNIZED_EVENT")
>>> +
>>
>> Since a compiler is allowed to use a signed type to implement an enum,
>> please cast "event" to an unsigned type before comparing it with the
>> array size. Additionally, please consider to define IB_EVENT() as an
>> inline function instead of a preprocessor macro.
>
> I can do that, any specific reason why to use inline over macro here?
Not really ... just a general preference for functions over macros. One
of the advantages we all know is that using a function instead of a
macro gives the compiler a chance to perform type checking on arguments.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-05-11 7:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1431252274-27739-1-git-send-email-sagig@mellanox.com>
[not found] ` <1431252274-27739-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-05-10 10:29 ` [PATCH RFC] IB/core, cma: Nice log-friendly string helpers Bart Van Assche
[not found] ` <554F32F3.1070308-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-05-10 10:45 ` Sagi Grimberg
[not found] ` <554F36BC.5070009-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-05-11 7:50 ` Bart Van Assche [this message]
2015-05-10 12:04 ` Or Gerlitz
[not found] <1431253542-14933-1-git-send-email-sagig@mellanox.com>
[not found] ` <1431253542-14933-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-05-11 13:44 ` Chuck Lever
2015-05-10 10:36 Sagi Grimberg
[not found] ` <1431254186-23554-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-05-10 20:22 ` Or Gerlitz
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=55505F56.4030907@sandisk.com \
--to=bart.vanassche-xdaiopvojttbdgjk7y7tuq@public.gmane.org \
--cc=chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox