From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailrelay.tugraz.at (mailrelay.tugraz.at [129.27.2.202]) by sourceware.org (Postfix) with ESMTPS id 897963858D20 for ; Sun, 11 Jun 2023 14:05:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 897963858D20 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=tugraz.at Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tugraz.at Received: from vra-169-212.tugraz.at (vra-169-212.tugraz.at [129.27.169.212]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4QfGmH44JZz1LM03; Sun, 11 Jun 2023 16:05:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4QfGmH44JZz1LM03 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1686492304; bh=1S5jRCvc5WJ89rldrTSvv4yWG4whYHGy0rpeFBrdpYA=; h=Subject:From:To:Cc:Date:In-Reply-To:From; b=UJwnTshPdkX/rzwKsH8JKGYKELLwACSbBNyO05ktNLK6KGHJHyFzSWTw4RoXOu6jJ bvd4OrVvF7V2LcPe3+QQEtt9EII9EZNa2wpjtno+RONwVF0JVDQb22FFc7VMKw6Ft3 LX+ZFwXVtdAr3Mxlcg/J/LI7d33w7/BNmxzQd9z4= Message-ID: <3134c67944e5a86f862b3cfefe67796b45509516.camel@tugraz.at> Subject: Re: [RFC] Add stdckdint.h header for C23 From: Martin Uecker To: jakub@redhat.com Cc: gcc-patches@gcc.gnu.org Date: Sun, 11 Jun 2023 16:05:03 +0200 In-Reply-To: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1+deb11u1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: G/VXY7/6zeyuAY/PU2/0qw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -0.4 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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