From: "Michael Young" <nobody@all.org>
Subject: Re: Printing Enum Variable Re: Linux World
Date: 1999/03/07
Date: 1999-03-07T00:00:00+00:00 [thread overview]
Message-ID: <7btj81$j0d$1@remarQ.com> (raw)
In-Reply-To: m3k8wufayz.fsf@deneb.cygnus.stuttgart.netsurf.de
There are many good things to be said about strong typing. I fail to see
your point, however, in comparing type safety in C to that in Ada. A
more appropriate comparison would be Ada to C++. In your (narrow)
example, the differences in implementation would be next to
indistinguishable. It's also worth noting that C++ destructors formalize
resource deallocation, addressing the resource leak issue very
effectively. (I never did understand dewar's strong admonition to avoid
using finalize for performance reasons. I'd love to hear a capsule
summary if that's possible.)
While I'm not especially fond of the old SDK, its structure looks
surprisingly like object use in Ada today. Instead of the more succinct
C++/Java style aWindow.GetDC(), we see GetDC(aWindow).
Anyway, I'm not sure which you were bashing: C in its infancy, or the
old SDK. Both were laudable in their days. I expect I might say the same
of Ada95 in some not so distant future.
Michael.
Florian Weimer <fw@cygnus.stuttgart.netsurf.de> wrote in message
news:m3k8wufayz.fsf@deneb.cygnus.stuttgart.netsurf.de...
> Samuel Mize <smize@imagin.net> writes:
>
> > /* one of these must be right, the other wrong */
> > SetWindow (W1, color, attribs);
> > SetWindow (W1, attribs, color);
>
> This reminds me of another C problem which is related to some point.
> For example, there once was a function called ReleaseDC(HWND hwnd,
> HDC hdc) on Microsoft Windows (don't know if still exists), which had
> to be called to release one of the five system-wide per-window drawing
> contexts. Of course, the `types' HWND and HDC were defined like this:
>
> typedef unsigned int HWND;
> typedef unsigned int HDC;
>
> Nothing prevented you from calling ReleaseDC(hdc, hwnd), thus not
> releasing the drawing context. This was especially annoying during
> software development---the machine froze if no more drawing contexts
> where available. But I've seen software which had this drawing
context
> leak and was delivered, too.
>
> In the final days of Win16, Microsoft used the following trick to make
> HWND and HDC (and the other handle types) distinct types:
>
> struct tagHWND { int dummy; };
> struct tagHDC { int dummy; };
>
> typedef struct tagHWND *HWND;
> typedef struct tagHDC *HDC;
>
> Of course, this extremely ugly and platform dependent, but in fact,
> it's quite helpful if you are programming with C (and not Ada ;).
> AFAIK it is still used with Win32.
next prev parent reply other threads:[~1999-03-07 0:00 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-02 0:00 Linux World Richard D Riehle
1999-03-02 0:00 ` fraser
1999-03-02 0:00 ` Printing Enum Variable " David Starner
1999-03-03 0:00 ` fraser
1999-03-03 0:00 ` David Starner
1999-03-03 0:00 ` fraser
1999-03-03 0:00 ` Samuel T. Harris
1999-03-04 0:00 ` robert_dewar
1999-03-03 0:00 ` David Starner
1999-03-04 0:00 ` robert_dewar
1999-03-04 0:00 ` Samuel Mize
1999-03-04 0:00 ` Samuel Mize
1999-03-05 0:00 ` Robert A Duff
1999-03-05 0:00 ` Robert A Duff
1999-03-07 0:00 ` Florian Weimer
1999-03-07 0:00 ` Michael Young [this message]
1999-03-07 0:00 ` Larry Kilgallen
1999-03-07 0:00 ` Michael Young
1999-03-08 0:00 ` robert_dewar
1999-03-08 0:00 ` Richard D Riehle
1999-03-09 0:00 ` Michael Young
1999-03-09 0:00 ` Larry Kilgallen
1999-03-09 0:00 ` billy
1999-03-10 0:00 ` Pascal Obry
1999-03-10 0:00 ` robert_dewar
1999-03-10 0:00 ` Dale Stanbrough
1999-03-10 0:00 ` dennison
1999-03-10 0:00 ` bob
1999-03-10 0:00 ` Mike Silva
1999-03-10 0:00 ` dennison
1999-03-10 0:00 ` Nick Roberts
1999-03-10 0:00 ` Richard D Riehle
1999-03-10 0:00 ` Pascal Obry
1999-03-09 0:00 ` Michael Young
1999-03-10 0:00 ` Mike Silva
[not found] ` <7c4ru6$e45$1@remarq.com>
1999-03-10 0:00 ` fraser
[not found] ` <7 <7c58qa$b6b$1@cf01.edf.fr>
1999-03-10 0:00 ` fraser
[not found] ` <1999Mar9.131659. <dale-1003991644340001@r1021c-07.ppp.cs.rmit.edu.au>
1999-03-10 0:00 ` Larry Kilgallen
1999-03-08 0:00 ` Florian Weimer
1999-03-08 0:00 ` Larry Kilgallen
1999-03-08 0:00 ` robert_dewar
1999-03-07 0:00 ` Matthew Heaney
1999-03-08 0:00 ` Michael Young
1999-03-08 0:00 ` Matthew Heaney
1999-03-04 0:00 ` Ehud Lamm
1999-03-05 0:00 ` Richard D Riehle
1999-03-05 0:00 ` Nick Roberts
1999-03-06 0:00 ` Ehud Lamm
1999-03-06 0:00 ` robert_dewar
1999-03-06 0:00 ` Larry Kilgallen
1999-03-06 0:00 ` Dave Taylor
1999-03-06 0:00 ` Bruce or Tracy
1999-03-06 0:00 ` Ehud Lamm
1999-03-04 0:00 ` dennison
1999-03-04 0:00 ` Ehud Lamm
1999-03-03 0:00 ` Fraser Wilson
1999-03-03 0:00 ` David Starner
1999-03-04 0:00 ` robert_dewar
1999-03-04 0:00 ` Richard D Riehle
1999-03-04 0:00 ` fraser
1999-03-05 0:00 ` Nick Roberts
1999-03-05 0:00 ` fraser
1999-03-04 0:00 ` Magnus Larsson
1999-03-03 0:00 ` Hans Marqvardsen
1999-03-04 0:00 ` Nick Roberts
1999-03-04 0:00 ` robert_dewar
1999-03-04 0:00 ` Hans Marqvardsen
1999-03-05 0:00 ` Larry Kilgallen
1999-03-05 0:00 ` dewar
1999-03-05 0:00 ` David Botton
1999-03-05 0:00 ` robert_dewar
1999-03-04 0:00 ` Hans Marqvardsen
1999-03-05 0:00 ` dewar
1999-03-07 0:00 ` Hans Marqvardsen
1999-03-03 0:00 ` Printing Enum Variable Re: Linux World (Correction) Hans Marqvardsen
1999-03-04 0:00 ` Printing Enum Variable Re: Linux World Richard D Riehle
1999-03-03 0:00 ` Larry Kilgallen
1999-03-03 0:00 ` Nick Roberts
1999-03-03 0:00 ` David Starner
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox