From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11207 invoked by alias); 20 Feb 2003 08:59:59 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 11194 invoked from network); 20 Feb 2003 08:59:57 -0000 Received: from unknown (HELO mail.polimi.it) (131.175.12.67) by 172.16.49.205 with SMTP; 20 Feb 2003 08:59:57 -0000 Received: from burning-guy (paolob@burning-guy.rett.polimi.it [131.175.65.145]) by mail.polimi.it (Switch-2.2.4/Switch-2.2.4) with ESMTP id h1K8xs510832; Thu, 20 Feb 2003 09:59:54 +0100 (MET) Content-Type: text/plain; charset="us-ascii" From: Paolo Bonzini Reply-To: bonzini@gnu.org To: gcc@gcc.gnu.org Subject: Re: Turning off C++ casting? Date: Thu, 20 Feb 2003 10:05:00 -0000 User-Agent: KMail/1.4.2 Cc: mongryong@sympatico.ca MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200302200957.32698.paolo.bonzini@polimi.it> X-SW-Source: 2003-02/txt/msg01346.txt.bz2 > But if I'm iterating over lots of > objects, I'd like to get rid off the cost of dynamic_cast when I know > for sure the objects will always be of this type. assert and the pointer version of dynamic_cast are your friends if you don'= t=20 want #ifdefs. assert (dynamic_cast(&baseObj) !=3D NULL); ExtendedObject& obj =3D *reinterpret_cast(&baseObj); > What I want to know is whether GCC allows you to optimize > 'dynamic_cast'ing: gcc -fno_dynamic_cast .... I don't think gcc has > such a switch. Maybe -fno-rtti (along with disabling much more)? Paolo