From owner-cvs-all Fri Jan 4 18:36:21 2002 Delivered-To: cvs-all@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 13C8237C12B; Fri, 4 Jan 2002 17:58:15 -0800 (PST) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 4A12914C53; Sat, 5 Jan 2002 02:58:12 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: "Justin T. Gibbs" Cc: Julian Elischer , Poul-Henning Kamp , Stephen McKay , John Baldwin , cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Julian Elischer , Greg Lehey Subject: Re: cvs commit: src/share/man/man3 queue.3 References: <200201042213.g04MDBg93058@aslan.scsiguy.com> From: Dag-Erling Smorgrav Date: 05 Jan 2002 02:58:11 +0100 In-Reply-To: <200201042213.g04MDBg93058@aslan.scsiguy.com> Message-ID: Lines: 34 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG "Justin T. Gibbs" writes: > Is the compiler smart enough to not bother testing the result > of the assignment? Looks like it: des@des ~/src% cat >optimize.c int optimizeme(int i) { for (i = 0; i < 10 || (i = 0); i++) ; return i; } ^D des@des ~/src% cc -O -o optimize.o -c optimize.c des@des ~/src% objdump -d optimize.o optimize.o: file format elf32-i386 Disassembly of section .text: 00000000 : 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 31 c0 xor %eax,%eax 5: 8d 76 00 lea 0x0(%esi),%esi 8: 40 inc %eax 9: 83 f8 09 cmp $0x9,%eax c: 7e fa jle 8 e: 31 c0 xor %eax,%eax 10: c9 leave 11: c3 ret 12: 89 f6 mov %esi,%esi The result of compiling without -O, btw, is too ugly for words. DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message