From: Martin Uecker <uecker@tugraz.at>
To: jakub@redhat.com
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [RFC] Add stdckdint.h header for C23
Date: Sun, 11 Jun 2023 16:05:03 +0200 [thread overview]
Message-ID: <3134c67944e5a86f862b3cfefe67796b45509516.camel@tugraz.at> (raw)
In-Reply-To: <ZIRgc6yxT0f2ofJl@tucnak>
Hi Jakup,
two comments which may or may not be helpful:
Clang extended _Generic in a similar way:
https://github.com/llvm/llvm-project/commit/12728e144994efe84715f4e5dbb8c3104e9f0b5a
Although for _Generic you can achieve the same with checking
for compatiblilty of pointer to the type, and I do not think
this helps with the classification problem.
If I am not missing something, you should be able to check
for an enumerated type using _Generic by checking that the
type is not compatible to another enum type:
enum type_check { _X = 1 };
#define type_is_enum(x) \
_Generic(x, unsigned int: _Generic(x, enum type_check: 0, default: 1), default: 0)
https://godbolt.org/z/j6z4a4Mdn
For C23 with fixed underlying type this may become more
complicated. Maybe this becomes to messy.
Martin
next prev parent reply other threads:[~2023-06-11 14:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-10 10:37 Jakub Jelinek
2023-06-10 11:37 ` Jakub Jelinek
2023-06-11 14:05 ` Martin Uecker [this message]
2023-06-12 10:35 ` Eric Gallager
2023-06-12 21:51 ` Joseph Myers
2023-06-13 6:28 ` Jakub Jelinek
2023-06-13 15:10 ` Joseph Myers
2023-06-13 15:20 ` Jakub Jelinek
2023-06-13 15:45 ` Joseph Myers
2023-06-14 2:54 ` Paul Eggert
2023-06-14 6:49 ` Jakub Jelinek
2023-06-14 11:46 ` Florian Weimer
2023-06-14 14:52 ` Joseph Myers
2023-06-14 15:50 ` Zack Weinberg
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=3134c67944e5a86f862b3cfefe67796b45509516.camel@tugraz.at \
--to=uecker@tugraz.at \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).