Article View: comp.lang.eiffel
Article #1205Re: Portability of code & skills (Beware of "C" Hackers etc)
From: Joachim Durchholz
Date: Sat, 23 Mar 1996 13:27
Date: Sat, 23 Mar 1996 13:27
44 lines
1826 bytes
1826 bytes
tej@world.std.com wrote 22.03.96 on Re: Portability of code & skills (Beware of "C" Hackers etc):
> I don't remember enough Pascal to know what you mean. I know you could
> define a function inside a function, making Pascal block-structured.
> C can't do that, but of course you can pass functions as arguments of
> functions.
The power of this mechanism is that the local function can access local
variables of its surrounding function. E.g. in a list processing
environment you could write
function CountThem (l: List): integer;
var Count: integer
procedure CountOne (e: ListElement);
begin
if <some condition on e fulfilled> then begin
Count := Count + 1;
end;
end;
begin
ApplyOnList (l, CountOne); (* !!!! *)
CountThem := Count
end;
> >No assertions
> I know it's dumb but what's wrong with assert() from assert.h?
Nothing wrong, but there are better frameworks. See programming-by-
contract (e.g. in Bertrand Meyer, Object-Oriented Software Construction,
Prentice Hall).
> >No opaque types
> a pointer to an empty struct declaration works fine.
The compiler cannot warn you if you inadvertently mix types.
> If you're going to compare Ada 95 to C '72, what's the point?
Agreed.
-Joachim
--
Im speaking for myself here.
## CrossPoint v3.1 ##
Technical Details
Message-ID:
<65O34-3-3RB@herold.franken.de>Path:
arc1-ca.pugleaf.net!herold.franken.de!jhdReferences:
<31494D29.4D4B@dmu.ac.uk> <DoG3HE.48E@assip.csasyd.oz> <31517E6F.5930@dmu.ac.uk> <DooBwC.8C0@world.std.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!herold.franken.de!jhd Date: 23 Mar 1996 14:27:00 +0100 From: jhd@herold.franken.de (Joachim Durchholz) Newsgroups: comp.lang.eiffel,comp.lang.c,comp.lang.c++,comp.object,comp.software-eng Message-ID: <65O34-3-3RB@herold.franken.de> References: <31494D29.4D4B@dmu.ac.uk> <DoG3HE.48E@assip.csasyd.oz> <31517E6F.5930@dmu.ac.uk> <DooBwC.8C0@world.std.com> Subject: Re: Portability of code & skills (Beware of "C" Hackers etc) X-Newsreader: CrossPoint v3.1