Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!homxb!whuts!mtune!rutgers!ukma!uunet!mcvax!enea!sommar From: sommar@enea.UUCP Newsgroups: comp.lang.misc,comp.lang.c Subject: Re: software ICs vs. libraries Message-ID: <2426@enea.UUCP> Date: Fri, 30-Oct-87 17:30:23 EST Article-I.D.: enea.2426 Posted: Fri Oct 30 17:30:23 1987 Date-Received: Tue, 3-Nov-87 02:17:31 EST References: <1691@culdev1.UUCP> <932@sugar.UUCP> Reply-To: sommar@enea.UUCP(Erland Sommarskog) Followup-To: comp.lang.misc Organization: ENEA DATA Svenska AB, Sweden Lines: 34 Xref: utgpu comp.lang.misc:791 comp.lang.c:4981 peter@sugar.UUCP (Peter da Silva) writes: >In article <1691@culdev1.UUCP>, drw@culdev1.UUCP (Dale Worley) writes: >> Another feature of "software ICs" comes from the fact that they are >> part of an object-oriented system. One can actually write, say, a >> linked list manager that will work on objects of *any* type. In most >> languages, this is impossible to do in a library routine. > >You can do it in 'C'. In fact the standard 'C' library for the Amiga comes >with exactly this tool. > >This deals with objects called "nodes". But, of course, you can pass any >struct >to these functions so long as the first element of the struct is a list or a >node. This is one place 'C' outshines more modern and more heavily typed >languages like Modula. Of course you could do this in assembler too, n'est-ce pas? Just stack an address to a block on the stack. The first word(s) in the block are the pointer to next block. And damn you if you forget them. The problem with C and assembler is that they leave the user to be reponsible for the correctness. If he forget the pointers in the struct, he may have a hard time to find out why the program crashes. Now, I don't speak Modula-2, so I can't speak for it. (But I can believe da Silva is right. My impression of Modula-2 has always been that it is just another Pascal dialect :-) Finally some high-level languages in which you can write the linked-list manager *with* type checking are Simula and Ada. (But you don't write it in Simula, the manager is already there as a part of the language.) -- Erland Sommarskog ENEA Data, Stockholm sommar@enea.UUCP It could have been worse; it could have been Pepsi.