Date: 05 Jan 2002 02:58:11 +0100 From: Dag-Erling Smorgrav <des@ofug.org> To: "Justin T. Gibbs" <gibbs@scsiguy.com> Cc: Julian Elischer <julian@elischer.org>, Poul-Henning Kamp <phk@critter.freebsd.dk>, Stephen McKay <mckay@thehub.com.au>, John Baldwin <jhb@FreeBSD.org>, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Julian Elischer <julian@FreeBSD.org>, Greg Lehey <grog@FreeBSD.org> Subject: Re: cvs commit: src/share/man/man3 queue.3 Message-ID: <xzppu4pmudo.fsf@flood.ping.uio.no> In-Reply-To: <200201042213.g04MDBg93058@aslan.scsiguy.com> References: <200201042213.g04MDBg93058@aslan.scsiguy.com>
next in thread | previous in thread | raw e-mail | index | archive | help
"Justin T. Gibbs" <gibbs@scsiguy.com> 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 <optimizeme>: 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 <optimizeme+0x8> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzppu4pmudo.fsf>