public inbox for kernelnewbies@kernelnewbies.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: daniel watson <ozzloy@challenge-bot.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: surround complex macros in ()
Date: Thu, 26 Aug 2021 09:28:22 +0200	[thread overview]
Message-ID: <YSdClvj2XIbUYxcY@kroah.com> (raw)
In-Reply-To: <20210826052144.GA6234@challenge-bot.com>

On Wed, Aug 25, 2021 at 10:21:44PM -0700, daniel watson wrote:
> let me know if this is the right place to ask.
> 
> i recently tried to make a commit adding parentheses around a macro
> value.
> 
> https://lore.kernel.org/linux-staging/20210817043038.GA9492@challenge-bot.com/
> 
> it was rejected as "This is not a real change that is needed."
> 
> at first, i thought this meant that the code would be identical with and
> without parentheses surrounding a complex macro's definition, when the
> macro is just typecasting an expression.  but then i came up with code
> where having parens or not changes the meaning of the code.
> 
> -------delete-me.c--------
> #define with ((int)a)
> #define sans (int)a

Note, this is NOT what your change was doing.

To duplicate what your change wanted to do, try doing:

#define with ((int)(10 * 20))
#define sans (int)(10 * 20)

Now see if that is any different when you use it.

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2021-08-26  7:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26  5:21 surround complex macros in () daniel watson
2021-08-26  7:28 ` Greg KH [this message]
2021-08-26  9:04 ` Valdis Klētnieks

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=YSdClvj2XIbUYxcY@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=ozzloy@challenge-bot.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox