From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14453 invoked by alias); 17 Oct 2007 11:42:26 -0000 Received: (qmail 14440 invoked by uid 22791); 17 Oct 2007 11:42:24 -0000 X-Spam-Check-By: sourceware.org Received: from chip2og54.obsmtp.com (HELO chip2og54.obsmtp.com) (64.18.13.45) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 17 Oct 2007 11:42:15 +0000 Received: from source ([192.150.11.134]) by chip2ob54.postini.com ([64.18.5.12]) with SMTP; Wed, 17 Oct 2007 04:41:56 PDT Received: from inner-relay-3.eur.adobe.com (inner-relay-3.adobe.com [192.150.20.198] (may be forged)) by outbound-smtp-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id l9HBdwIQ016281; Wed, 17 Oct 2007 04:40:03 -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 l9HBfnFV009627; Wed, 17 Oct 2007 04:41:49 -0700 (PDT) Received: from namailgen.corp.adobe.com ([10.8.192.91]) by fe1.corp.adobe.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 17 Oct 2007 04:41:49 -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 namailhost.corp.adobe.com ([10.8.192.72]) with Microsoft Exchange Server HTTP-DAV ; Wed, 17 Oct 2007 11:41:48 +0000 User-Agent: Microsoft-Entourage/11.3.6.070618 Date: Wed, 17 Oct 2007 11:48:00 -0000 Subject: Re: gcc warnings From: John Love-Jensen To: "Humpolicek, Jiri - Acision" , MSX to GCC Message-ID: In-Reply-To: <53248A54C3B3EC4EAAD993D10A6DD01203C5DAB7@cz-ex002.groupinfra.com> Mime-version: 1.0 Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable 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: 2007-10/txt/msg00209.txt.bz2 Hi Jiri, It's valid C code to assign from a variable of greater type to one of smaller type. I think that this is very unfortunate. I presume you do as well. Alas. You can act upon it programmatically, in runtime, if you do something like: #include "stdio.h" unsigned char LongAsUnsignedChar(long c) { if(c > 255 || c < 0) { fprintf(stderr, "Error: %ld outside of 0,255 range\n", c); } return c; } int main() { =A0 long a =3D 10000; =A0 unsigned char b =3D LongAsUnsignedChar(a); =A0 printf("%d\n", b); =A0 return b; } Alternatively, you can use a B&D language like Ada where such assignments cannot happen silently and need explicit conversion. HTH, --Eljay