* Problem in ENCODE_CHAR macro
@ 2016-02-26 20:45 Aurélien Aptel
2016-02-26 21:07 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: Aurélien Aptel @ 2016-02-26 20:45 UTC (permalink / raw)
To: Emacs development discussions
Hi,
#define ENCODE_CHAR(charset, c) \
(verify_expr \
(sizeof (c) <= sizeof (int), \
(ASCII_CHAR_P (c) && (charset)->ascii_compatible_p \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
? (unsigned) (c)
?: has lower precedence than &&.
Shouldn't the underlined part be wrapped in extra paren?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem in ENCODE_CHAR macro
2016-02-26 20:45 Problem in ENCODE_CHAR macro Aurélien Aptel
@ 2016-02-26 21:07 ` Andreas Schwab
2016-02-26 21:17 ` Aurélien Aptel
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2016-02-26 21:07 UTC (permalink / raw)
To: Aurélien Aptel; +Cc: Emacs development discussions
Aurélien Aptel <aurelien.aptel@gmail.com> writes:
> Hi,
>
> #define ENCODE_CHAR(charset, c) \
> (verify_expr \
> (sizeof (c) <= sizeof (int), \
> (ASCII_CHAR_P (c) && (charset)->ascii_compatible_p \
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ? (unsigned) (c)
>
>
> ?: has lower precedence than &&.
> Shouldn't the underlined part be wrapped in extra paren?
But as you say, && has higher precedence, thus such parens won't change
anything.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem in ENCODE_CHAR macro
2016-02-26 21:07 ` Andreas Schwab
@ 2016-02-26 21:17 ` Aurélien Aptel
0 siblings, 0 replies; 3+ messages in thread
From: Aurélien Aptel @ 2016-02-26 21:17 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Emacs development discussions
On Fri, Feb 26, 2016 at 10:07 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Aurélien Aptel <aurelien.aptel@gmail.com> writes:
> But as you say, && has higher precedence, thus such parens won't change
> anything.
Right. Nevermind. I recently had a bug involving bitwise and logical
AND precedence and now I'm paranoid.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-26 21:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-26 20:45 Problem in ENCODE_CHAR macro Aurélien Aptel
2016-02-26 21:07 ` Andreas Schwab
2016-02-26 21:17 ` Aurélien Aptel
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).