From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21446 invoked by alias); 17 Feb 2011 14:05:50 -0000 Received: (qmail 21438 invoked by uid 22791); 17 Feb 2011 14:05:49 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-iw0-f175.google.com (HELO mail-iw0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Feb 2011 14:05:43 +0000 Received: by iwn8 with SMTP id 8so2538009iwn.20 for ; Thu, 17 Feb 2011 06:05:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.225.133 with SMTP id is5mr2742555icb.325.1297951541999; Thu, 17 Feb 2011 06:05:41 -0800 (PST) Received: by 10.42.230.68 with HTTP; Thu, 17 Feb 2011 06:05:41 -0800 (PST) In-Reply-To: <20110217130938.GT5274@axel> References: <4D5C437F.5080207@cds1.net> <20110217094436.GQ5274@axel> <20110217130938.GT5274@axel> Date: Thu, 17 Feb 2011 14:08:00 -0000 Message-ID: Subject: Re: infinite for-loop and related question From: Jonathan Wakely To: gcc-help@gcc.gnu.org Cc: Axel Freyn 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: 2011-02/txt/msg00260.txt.bz2 On 17 February 2011 13:09, Axel Freyn wrote: >> >> I'm guessing you didn't bother to actually compile that and test it? > Well, I did. But using gcc instead of g++. I get values <128 as soon as > I add the integer conversion (in C code). Jason's original code used char i(1) which is not valid C ;-) In any case, I get the same behaviour in C as C++, the cast to int makes no difference. Did you use optimization? >> See 5.2.2 [expr.call] paragraph 7 in the C++ standard. =A0Arguments to >> varargs functions are subject to integral promotions. > In C++ it does not make any difference. C has the same rules for default argument promotions, see 6.5.2.2 paragraph= 6