From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24687 invoked by alias); 5 Aug 2008 18:43:10 -0000 Received: (qmail 24679 invoked by uid 22791); 5 Aug 2008 18:43:10 -0000 X-Spam-Check-By: sourceware.org Received: from exprod6og116.obsmtp.com (HELO exprod6og116.obsmtp.com) (64.18.1.37) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Aug 2008 18:42:31 +0000 Received: from source ([192.150.8.22]) by exprod6ob116.postini.com ([64.18.5.12]) with SMTP; Tue, 05 Aug 2008 11:42:26 PDT Received: from inner-relay-3.eur.adobe.com (inner-relay-3b [10.128.4.236]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id m75IgOE0025238; Tue, 5 Aug 2008 11:42:25 -0700 (PDT) Received: from fe1.corp.adobe.com (fe1.corp.adobe.com [10.8.192.70]) by inner-relay-3.eur.adobe.com (8.12.10/8.12.9) with ESMTP id m75IgJqN010926; Tue, 5 Aug 2008 11:42:23 -0700 (PDT) Received: from namailgen.corp.adobe.com ([10.8.192.91]) by fe1.corp.adobe.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Aug 2008 11:42:22 -0700 Received: from 10.32.16.88 ([10.32.16.88]) by namailgen.corp.adobe.com ([10.8.192.91]) via Exchange Front-End Server namail.corp.adobe.com ([10.8.189.100]) with Microsoft Exchange Server HTTP-DAV ; Tue, 5 Aug 2008 18:42:21 +0000 User-Agent: Microsoft-Entourage/12.11.0.080522 Date: Tue, 05 Aug 2008 18:43:00 -0000 Subject: Re: Undesired automatic cast, workarounds? From: John Love-Jensen To: , GCC-help Message-ID: In-Reply-To: <200808050828.00033.palvarado@ietec.org> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg00054.txt.bz2 Hi Pablo, > for some reason now the operator+ automatically converts the ubyte to int, That's correct. That's what the compiler should do. > ... generating in the above code a warning. What warnings are you enabling? That should not be a default warning (but I don't have GCC 4.3.1 at my disposal to confirm). > This has been ok with all previous gcc compilers. All previous GCC compilers promote unsigned char to int. (I don't know of any that promote unsigned char to unsigned int, but it could happen in some uncommon kinds of architectures.) > Is there any way to deactivate this? There should be a -Wno-blah switch to turn off the warning. But I'm surprised that it is enabled in the first place. The only way to deactivate promoting an unsigned char to int is to use a different language which does not do that promotion. Both C and C++ promote. > I mean, not only the warning but avoiding the unnecesary casts? To avoid the casts, use int or unsigned int instead of unsigned char. HTH, --Eljay