From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25578 invoked by alias); 19 Aug 2008 16:17:31 -0000 Received: (qmail 25473 invoked by uid 22791); 19 Aug 2008 16:17:30 -0000 X-Spam-Check-By: sourceware.org Received: from xena.cds1.net (HELO mail.cds1.net) (216.174.197.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 19 Aug 2008 16:16:40 +0000 Received: from localhost (neptune-canopy.cds1.net [172.16.10.246]) by mail.cds1.net (Postfix) with ESMTP id 72E5BE00051E; Tue, 19 Aug 2008 09:16:38 -0700 (PDT) Received: from mail.cds1.net ([172.16.10.33]) by localhost (neptune.cds1.net [172.16.10.246]) (amavisd-new, port 10024) with ESMTP id y41EZvP2qsEm; Tue, 19 Aug 2008 09:16:38 -0700 (PDT) Received: from [192.168.1.103] (dhcp-172-16-14-253.cds1.net [172.16.14.253]) by mail.cds1.net (Postfix) with ESMTP id 0B92EE89EC54; Tue, 19 Aug 2008 09:16:36 -0700 (PDT) Subject: Re: regarding type promotion From: Bob Plantz To: "Sivaprasad.pv" Cc: gcc In-Reply-To: <48AA5377.9080001@redpinesignals.com> References: <48AA5377.9080001@redpinesignals.com> Content-Type: text/plain Date: Tue, 19 Aug 2008 16:33:00 -0000 Message-Id: <1219162574.6008.7.camel@bob-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 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/msg00172.txt.bz2 On Tue, 2008-08-19 at 10:30 +0530, Sivaprasad.pv wrote: > Is there any way to specify in gcc to perform implicit type promotion > first and then perform operation on it (without explicit type casting). I spent over three decades reading other people's code -- both in industry and teaching. I always encouraged my students to use explicit type casting, even when not needed, for it's self-documenting value. Another rule I gave them is "multiplication and division have higher precedence than addition and subtraction; use parentheses in all other cases." Both "rules of thumb" help the reader to see your intent and minimize your chances of making a mistake. Bob