From: Dave Thompson <david.thompson1@worldnet.att.net>
Subject: Re: [announcement] SYSAPI and SYSSVC for Windows
Date: Sun, 28 Dec 2003 01:49:03 GMT
Date: 2003-12-28T01:49:03+00:00 [thread overview]
Message-ID: <bicsuvgd4qqqbmh21j3k9lb1epg8m4d8j3@4ax.com> (raw)
In-Reply-To: bs47jo$9e9ea$1@ID-77047.news.uni-berlin.de
On Sun, 21 Dec 2003 14:42:09 +0100, "Dmitry A. Kazakov"
<mailbox@dmitry-kazakov.de> wrote:
> Ekkehard Morgenstern wrote:
<snip>
> >> A *number of* standards, fascinating! (:-))
> >
Aside from the "development under actual use" period, C has had two
full standards (89/90 and 99) and one Normative Amendment (95),
compared to two for Ada. Not *that* different.
> > For Ada, there's also an '83 and a '95 rationale. ;)
>
> Ada 95 practically includes Ada 83, with very minor exceptions. Rationale is
> not the standard, it is rather comments to the standard. BTW, there is also
> AARM - Annotated Ada Reference Manual.
>
There was a rationale in C89 (the ANSI-only standard), and is a draft
still being worked on last I looked for C99, but neither of them as
complete or IMO clear, much less integrated, as the ARM annotations.
> >> Come on! C++ does not have:
> >>
> >> 1. multiple dispatch;
> >
> > True, except for constructors and destructors. They're always called for
> > all derived classes of an object.
>
> This is not multiple dispatch. MD is when, for example:
>
> type Matrix is tagged ...;
> function "+" (X, Y : Matrix) return Matrix;
> -- This is dispatching in X, Y and the result
>
Or more generally types not in the same hierarchy like the "standard"
procedure Eat (X: Animal; Y: Food);
> In C++ only one (hidden) parameter can be dispatching. All others are
> contravariant, which leads to numerous nasty pitfalls
>
No, in C++ child method parameters are the same type. In fact, trying
to make an overrider covariant instead hides the parent method, which
seems to be a fairly common bug. The *return* type (which in C++ does
not contribute to dispatching) can be covariant, but only as a pointer
or reference; as you note there are no polymorphic/classwide *values*
in C++. The only *contra*variance is in pointer-to-member conversions,
to which Ada has no direct analog I know of.
<snip>
> >> 5. functions returning class-wide objects on the stack;
> >
> > True, but you can return a reference to an object. (I'm not sure if
> > passing a reference to a temporary object would work)
>
> This won't help, because of 4. The same type name is sometimes denotes
> class-wide, sometimes specific in C++. In declarations it is always
> specific, so you cannot do:
>
For an actual object it is always specific; for a pointer or reference
always polymorphic/classwide iff the class has any 'virtual' methods
(i.e. has a vtable = is tagged and not just a record/struct/data).
> declare
> X : Object'Class := Get_From_File; -- Any descendant of Object
>
> To achive same effect, you have to use the heap:
>
Or other programmer-managed storage like static, a private pool, etc.
But not automatic, which is the point.
> X_Ptr * Object = Get_From_File (); // internally calls new
> ...
> free (X_Ptr); // do not forget to release it
>
You presumably meant free(Object). In fact, officially you must use
delete iff it was allocated with new* and free() iff it was allocated
with C-style malloc-or-friends; implementations of these are not
required to be interchangeable, though they usually if not always are.
(* and even worse delete [] if the new was actually of an array, even
though that may be hidden inside the other module. Which is a good
reason to provide and use an e.g. do_delete method instead.)
- David.Thompson1 at worldnet.att.net
next prev parent reply other threads:[~2003-12-28 1:49 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-17 19:17 [announcement] SYSAPI and SYSSVC for Windows amado.alves
2003-12-17 19:56 ` Georg Bauhaus
2003-12-18 9:08 ` Dmitry A. Kazakov
2003-12-18 12:14 ` Ekkehard Morgenstern
2003-12-18 13:31 ` Georg Bauhaus
2003-12-19 10:45 ` Ekkehard Morgenstern
2003-12-19 17:12 ` Georg Bauhaus
2003-12-19 17:22 ` Vinzent 'Gadget' Hoefler
2003-12-20 0:21 ` Ekkehard Morgenstern
2003-12-20 2:18 ` Georg Bauhaus
2003-12-20 4:40 ` Ekkehard Morgenstern
2003-12-21 3:45 ` Georg Bauhaus
2003-12-21 19:01 ` Piracy was " Robert I. Eachus
2003-12-18 14:32 ` Dmitry A. Kazakov
2003-12-19 11:11 ` Ekkehard Morgenstern
2003-12-19 15:15 ` Hyman Rosen
2003-12-19 15:50 ` Ekkehard Morgenstern
2003-12-19 16:48 ` Hyman Rosen
2003-12-19 16:57 ` Hyman Rosen
2003-12-20 1:17 ` Ekkehard Morgenstern
2003-12-21 2:19 ` Hyman Rosen
2003-12-21 10:34 ` Ekkehard Morgenstern
2003-12-22 9:02 ` Hyman Rosen
2003-12-22 15:17 ` Ekkehard Morgenstern
2003-12-22 15:08 ` Hyman Rosen
2003-12-22 15:31 ` Ekkehard Morgenstern
2003-12-22 16:35 ` Ekkehard Morgenstern
2003-12-23 1:47 ` Hyman Rosen
2003-12-23 8:40 ` Ekkehard Morgenstern
2003-12-23 9:05 ` Stephen Leake
2003-12-19 17:06 ` Dmitry A. Kazakov
2003-12-20 1:49 ` Ekkehard Morgenstern
2003-12-20 11:13 ` Dmitry A. Kazakov
2003-12-20 13:40 ` Ekkehard Morgenstern
2003-12-20 17:21 ` Dmitry A. Kazakov
2003-12-20 19:52 ` Ekkehard Morgenstern
2003-12-21 4:24 ` Georg Bauhaus
2003-12-21 13:42 ` Dmitry A. Kazakov
2003-12-21 15:48 ` Ekkehard Morgenstern
2003-12-21 17:46 ` Michal Morawski
2003-12-21 18:05 ` Ekkehard Morgenstern
2003-12-22 0:50 ` Robert I. Eachus
2003-12-23 23:02 ` Robert A Duff
2003-12-24 11:20 ` Dmitry A. Kazakov
2003-12-24 16:57 ` Robert A Duff
2003-12-25 14:00 ` Dmitry A. Kazakov
2003-12-28 1:49 ` Dave Thompson [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-12-15 14:18 Ekkehard Morgenstern
2003-12-15 15:10 ` Ekkehard Morgenstern
2003-12-15 17:10 ` Jeffrey Carter
2003-12-15 18:38 ` Ekkehard Morgenstern
2003-12-16 0:25 ` Stephen Leake
2003-12-16 0:56 ` Ekkehard Morgenstern
2003-12-16 2:47 ` Ludovic Brenta
2003-12-16 17:45 ` Ekkehard Morgenstern
2003-12-16 19:54 ` Ludovic Brenta
2003-12-16 22:09 ` Ekkehard Morgenstern
2003-12-17 15:24 ` Ludovic Brenta
2003-12-17 23:23 ` Ekkehard Morgenstern
2003-12-19 18:14 ` Warren W. Gay VE3WWG
2003-12-16 5:36 ` tmoran
2003-12-16 17:30 ` Ekkehard Morgenstern
2003-12-15 20:44 ` David Marceau
2003-12-16 0:34 ` Ekkehard Morgenstern
2003-12-17 12:05 ` Dmitry A. Kazakov
2003-12-17 15:00 ` Ekkehard Morgenstern
2003-12-20 19:24 ` Ekkehard Morgenstern
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox