From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10637 invoked by alias); 22 May 2014 22:20:46 -0000 Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org Received: (qmail 10614 invoked by uid 89); 22 May 2014 22:20:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: elastic.org Received: from elastic.org (HELO elastic.org) (69.20.226.105) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 22 May 2014 22:20:42 +0000 Received: from super.elastic.org (localhost [127.0.0.1]) by elastic.org (8.14.7/8.14.7) with ESMTP id s4MMKE52015641 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 May 2014 18:20:14 -0400 Received: (from fche@localhost) by super.elastic.org (8.14.7/8.14.7/Submit) id s4MMKCKC015640; Thu, 22 May 2014 18:20:12 -0400 Date: Thu, 22 May 2014 22:20:00 -0000 From: "Frank Ch. Eigler" To: "Maciej W. Rozycki" Cc: Stefan Kristiansson , cgen@sourceware.org, Alan Modra , fche@sourceware.org, Christian Svensson , Pierre Muller Subject: Re: [PATCH] Make large enum constants unsigned Message-ID: <20140522222012.GH4031@elastic.org> References: <20140522052921.GA30609@chokladfabriken.org> <20140522150956.GC4031@elastic.org> <20140522210621.GF4031@elastic.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-q2/txt/msg00016.txt.bz2 Hi - > > > > (string-append "(signed int)" (number->string (cadr e))) > > > [...] > > > how would that be better than? > > > (string-append (number->string (cadr e)) "U") > > > > It would be a closer match to expressing our desire to match C enum > > typing, but I'd be fine with "U" suffixing too. > > TBH I don't understand what you mean here, a C compiler is free to choose > from `char', `int' and `unsigned int' as the underlying (compatible) type > of an enumeration as long as the type can represent all the member values > defined. [...] I'm not a language lawyer, and in different levels of the language this has changed, but my understanding is that to be most compatible, the enumerators (the given literals) need to be 'int's. (It's a separate question as to what type the compiler would allocate to an enum FOO variable.) > over the `unsigned int' type here? If this is used to produce a bit mask, > which I gather it is, then I find using an unsigned type more natural. I see what you mean. - FChE