Abstract Data Types in C

John Woods john at frog.UUCP
Wed Oct 19 11:41:00 AEST 1988


In article <116 at capshaw.UUCP>, sdc at capshaw.UUCP (Dan Capshaw) writes:
> A friend that does a lot of program development in PASCAL has
> found that using Abstract Data Types (ADTs) significantly
> increases his productivity by minimizing his debugging time...
> One reason my friend doesn't like C is because he doesn't feel
> ADTs can be used effectively in C...
> Is anyone out there using ADTs in C?

Almost anyone using the Standard IO library functions are using an Abstract
Data Type (excluding the few mutants who JUST HAVE to personally fiddle with
_cnt or _ptr).  There may be a strong tendancy for C programmers to make sure
that the details of their data types are visible (so they can "maximize"
efficiency by banging structure elements, for example), yet C is perfectly
amenable to data abstraction (with just a hint of programmer discipline).

By way of contrast:  the CLU language (invented by Liskov (and others?) at
MIT) is all about data abstraction, and makes it a natural part of the
language; a number of CLU adherents maintain that you cannot do data
abstraction without such language support.  However, I took the Software
Engineering course the year before the CLU compiler was ready, and they taught
data abstraction using plain old PL/I, with a few little library tricks to
make sure that abstract pointers stayed abstract:  they insisted that you tag
structures with the name of the abstraction, and that you use their "up" and
"down" routines to turn real pointers into opaque pointers and vice versa;
an opaque pointer had its address modified so it was invalid and would cause
a progam crash if referenced as if it were real.
-- 
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, john at frog.UUCP, ...!mit-eddie!jfw, jfw at eddie.mit.edu

	Goooooood Morning Discovery!	-Robin Williams

	Abracadabra, 'press to MECO', America is back in space!



More information about the Comp.lang.c mailing list