From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson To: "Joseph S. Myers" Cc: Jakub Jelinek , gcc@gcc.gnu.org Subject: Re: new __builtin_choose_type (patch) (new builtin_equal_types patch) Date: Fri, 05 Oct 2001 16:14:00 -0000 Message-id: <20011005161355.C11260@redhat.com> References: <20011005120318.A1620@sunsite.ms.mff.cuni.cz> X-SW-Source: 2001-10/msg00359.html On Fri, Oct 05, 2001 at 12:02:32PM +0100, Joseph S. Myers wrote: > I think the following (which would need to be grammer symbols rather than > simple built-in functions) should suffice: > > __builtin_types_compatible_p (T1, T2) - returns 1 if the unqualified > versions of the types T1 and T2 (which are types, not expressions) are > compatible, 0 otherwise, and can be used in integer constant expressions. Yep. > __builtin_choose_expr (C, E1, E2) - returns E1 (and has the type of E1) if > C is true, otherwise returns E2 (and has the type of E2). C must be an > integer constant expression. Ideally, we would want that if C is true E2 is not checked for semantic correctness. That is, int x; __builtin_choose_expr(1, 2, x->foo) evaluates to 2 without error. I'm not sure we can do this with our current front end though. r~