From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16476 invoked by alias); 15 Jan 2004 14:07:44 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 16394 invoked from network); 15 Jan 2004 14:07:39 -0000 Received: from unknown (HELO prometheus.ds9.ch) (212.101.16.178) by sources.redhat.com with SMTP; 15 Jan 2004 14:07:39 -0000 Received: by prometheus.ds9.ch (Postfix, from userid 502) id B3761FAE1; Thu, 15 Jan 2004 15:07:38 +0100 (MET) Date: Thu, 15 Jan 2004 14:07:00 -0000 From: Marcel Lanz To: Michael Elizabeth Chastain Cc: eliz@elta.co.il, gdb@sources.redhat.com Subject: Re: gdb, c++ & namespaces Message-ID: <20040115140738.GA22662@ds9.ch> References: <20040115125112.182744B104@berman.michael-chastain.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040115125112.182744B104@berman.michael-chastain.com> User-Agent: Mutt/1.3.28i X-SW-Source: 2004-01/txt/msg00193.txt.bz2 If I think of a "the type that the pointer says" in C++ this is a pointer of type A pointing to something which is not of type A; hence its casted to another type or its a pointer to a derived class. "the type that the object in memory has" is a pointer of type A that points to an object of type A. I would say, that polymorphism is like casting type A to B if you can be sure that all invariants are valid if you use the object after the cast. With dynamic_cast(a); you can cast a polymorphic object in a safe manner on runtime. This way, I would say that a "dynamic type" is a polymorphic type. A "static type" is a non-polymorphic type. void* in C is a very havy polymorphic type but not safe. C++'s aim was to avoid the void* and make type casting safe. So if we discuss about "dynamic type" and "static type" for the debugger, its perhaps not a good idea to use C++ known names for it, because "a pointer of type A which points in a unsafe manner to something of type B" is not in the spirit of C++. What about "pointer type" and "object type" ? Marcel On Thu, Jan 15, 2004 at 07:51:12AM -0500, Michael Elizabeth Chastain wrote: > eli> The manual doesn't mention "static type" and "dynamic type" in the > eli> section that describes "set pruint". I think it should, if thi > eli> terminology is to be widely accepted. > > I don't know what the popular usage in the C++ community is. > I don't want to invent new phrases if there are existing phrases. > > I checked "The C++ Programming Language" and it does not have > any nice phrases to distinguish "the type that the pointer says" > versus "the type that the object in memory has". > > Michael C -- Marcel Lanz http://www.ds9.ch/lanz/ marcel.lanz@ds9.ch | marcel.lanz@n-1.ch GnuPG: F975 C6F7 04C8 642B 6DF4 4DF4 2945 F02A 797E 7DAB