From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26432 invoked by alias); 25 Dec 2007 03:00:20 -0000 Received: (qmail 26418 invoked by uid 22791); 25 Dec 2007 03:00:19 -0000 X-Spam-Check-By: sourceware.org Received: from Unknown (HELO devsrv.otsc.com.cn) (203.187.177.119) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 25 Dec 2007 03:00:08 +0000 Received: from [192.168.0.7] (longhaitao [192.168.0.7]) by devsrv.otsc.com.cn (Postfix) with ESMTP id 9CC72465F64; Tue, 25 Dec 2007 10:56:44 +0800 (CST) Subject: Re: a question about code optimization From: =?UTF-8?Q?=E9=BE=99=E6=B5=B7=E6=B6=9B?= To: Christoph Bartoschek Cc: gcc-help@gcc.gnu.org In-Reply-To: <200712221121.22411.bartoschek@gmx.de> References: <476CA397.2010505@otsc.com.cn> <200712221121.22411.bartoschek@gmx.de> Content-Type: text/plain Date: Tue, 25 Dec 2007 03:00:00 -0000 Message-Id: <1198551608.2505.9.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.0 (2.8.0-7.fc6) Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2007-12/txt/msg00414.txt.bz2 > Here the situation is quite simple. Because a is a template the > vector::size() method is probably included in the header files. This > means that the compiler can examine or inline the code of the method. If the > compiler additionally determines that in /*do something*/ the size is not i want to know whether Gcc can determines the size is changed or not... i did some experiment, and the result is not bad. anyone can give me some theoritical hints? > changed, then the optimization is quite straigthforward > > Christoph