From owner-freebsd-hackers Wed Nov 6 8:58:19 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 17A7637B401 for ; Wed, 6 Nov 2002 08:58:18 -0800 (PST) Received: from straylight.ringlet.net (office.sbnd.net [217.75.140.130]) by mx1.FreeBSD.org (Postfix) with SMTP id 615E643E3B for ; Wed, 6 Nov 2002 08:58:13 -0800 (PST) (envelope-from roam@ringlet.net) Received: (qmail 44313 invoked by uid 1000); 6 Nov 2002 16:57:26 -0000 Date: Wed, 6 Nov 2002 18:57:26 +0200 From: Peter Pentchev To: Marc Olzheim Cc: hackers@FreeBSD.ORG Subject: Re: /usr/src/ed/bin/re.c:99 Message-ID: <20021106165726.GU369@straylight.oblivion.bg> Mail-Followup-To: Marc Olzheim , hackers@FreeBSD.ORG References: <20021106164653.GA95733@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JB7KW7Ey7eB5HOHs" Content-Disposition: inline In-Reply-To: <20021106164653.GA95733@stack.nl> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --JB7KW7Ey7eB5HOHs Content-Type: text/plain; charset=windows-1251 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 06, 2002 at 05:46:53PM +0100, Marc Olzheim wrote: > .. > if ((nd =3D parse_char_class(++nd)) =3D=3D NULL) { > .. >=20 > Hmmm... is this legal ? >=20 > http://www.eskimo.com/~scs/C-faq/q3.1.html seems to tell otherwise... In this particular case, the value of 'nd' is not *used* anywhere in the expression. The fact that 'nd' is *assigned to* is not influenced in any way by the change of its value. It is absolutely certain that the compiler will put the code calculating the value of the argument to parse_char_class() before the code actually invoking parse_char_class(), and that it will also place the code invoking parse_char_class() before the code which assigns the return value to 'nd'.. thus, it is absolutely certain that 'nd' will be assigned the correct value. Once again: the main reason why q3.1 is not relevant here is the fact that q3.1 deals with expressions where the value of 'nd' is used; here, the left side of the assignment does not 'use' the value, it *changes* it :) Hope that helps. G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 I've heard that this sentence is a rumor. --JB7KW7Ey7eB5HOHs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE9yUn27Ri2jRYZRVMRAqybAJwKf6/wkjkB5mizVZYnpYnLLPpoPwCgnMqr t0q1XtZ+XDpp7b1rKzVTjbw= =QSy2 -----END PGP SIGNATURE----- --JB7KW7Ey7eB5HOHs-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message