From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14043 invoked by alias); 5 Aug 2008 14:27:58 -0000 Received: (qmail 14022 invoked by uid 22791); 5 Aug 2008 14:27:57 -0000 X-Spam-Check-By: sourceware.org Received: from mail45.opentransfer.com (HELO mail45.opentransfer.com) (76.162.254.45) by sourceware.org (qpsmtpd/0.31) with SMTP; Tue, 05 Aug 2008 14:27:18 +0000 Received: (qmail 8014 invoked by uid 399); 5 Aug 2008 14:27:15 -0000 Received: from unknown (HELO palvarado-linux.local) (201.206.30.189) by mail45.opentransfer.com with SMTP; 5 Aug 2008 14:27:15 -0000 From: Pablo Alvarado Reply-To: palvarado@ietec.org To: gcc-help@gcc.gnu.org Subject: Undesired automatic cast, workarounds? Date: Tue, 05 Aug 2008 14:27:00 -0000 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808050828.00033.palvarado@ietec.org> 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/msg00048.txt.bz2 Hello all, I tried yesterday GCC 4.3.1 for the first time, and I encountered a bad surprise. If I do typedef unsigned char ubyte; ubyte a,b,c; c=a+b; c+=a; for some reason now the operator+ automatically converts the ubyte to int, generating in the above code a warning. This has been ok with all previous gcc compilers. Is there any way to deactivate this? I mean, not only the warning but avoiding the unnecesary casts? This new behaviour is even worse in the following cases: typedef signed char byte; byte a,b,c; ... a=-b; // the operator- also produces an int ! or c=b/a; // the operator/ also produces an int in the later cases the casts to are absolutelly innecessary, since the results are always in range (assuming a!=0 of course)! Any hints will be very welcome, Pablo