Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: "DeHackEd" , djgpp AT delorie DOT com Date: Fri, 26 Dec 1997 16:03:22 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Optmization and Exceptions In-reply-to: Precedence: bulk "DeHackEd" wrote: > I was just playing around with the C++ compiler and I noticed a few things: > > 1) Without optmizations, strlen("string literal") evaluates to asm > LC1: > .ascii "string literal\0" > > pushl $LC1 > call _strlen > > But with -O3, it just evaluates to $14 (I think - I can't count). And what's the problem! that's what you want! optimized code! strlen is inline and GCC with -O3 is good enough to evaluate the operation in compile time. > 2) With or without optmizations, (12*5) evaluates to $60, not a long asm output > for calculating it. This is something which came up as a problem on some > newsgroup. GCC EVER optimizes multiplications. GCC simply doesn't use mul in i386 platform if one of the values is known at compile time. That's very good. It generates better code than a lot of assembler programmers! I don't understand very well, are you showing the good things you found? We can saturate the list with it ;-)) SET ------------------------------------ 0 -------------------------------- Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013