Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 22 Nov 2001 07:03:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 22 Nov 2001 07:03:40 -0500 Received: from leibniz.math.psu.edu ([146.186.130.2]:40129 "EHLO math.psu.edu") by vger.kernel.org with ESMTP id ; Thu, 22 Nov 2001 07:03:30 -0500 Date: Thu, 22 Nov 2001 07:03:28 -0500 (EST) From: Alexander Viro To: Horst von Brand cc: Stevie O , Vincent Sweeney , vda , linux-kernel@vger.kernel.org Subject: Re: [BUG] Bad #define, nonportable C, missing {} In-Reply-To: <200111221146.fAMBk8XF006908@pincoya.inf.utfsm.cl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Nov 2001, Horst von Brand wrote: > Stevie O said: > > But x++ is postincrement though. That means the value of 'x' is inserted, > > and after the expression is evaluated, x is incremented. Right? > > Nope. x++ increments x sometime (not defined when) after taking the value. > > x = x++ % y > > is wrong: There is just one sequence point at the end of the expression, > and x is modified twice in between (++ and =). Or look at it that way: both tmp = x % y; x++; x = tmp; and tmp = x % y; x = tmp; x++; are possible interpretations with different results. And as usual, compiler is allowed to do literally anything whenever it sees such beast. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/