[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Why is C so popular?



On Wed, Aug 27, 2003 at 12:43:55PM +0200, Frank Gevaerts wrote:
} On Wed, Aug 27, 2003 at 01:11:08AM -0500, Alex Malinovich wrote:
[...]
} First convince me that object oriented programming results in
} maintainable and debuggable code, then convince me that C++ is a good
} implementation of OO, and then I might consider C++ instead of C. (I
} know not all the features of C++ are related to OO, but OO seems to be
} the main selling point of C++ vs C)

OO was, at one time, the primary purpose of C++ extending C. It no longer
is. C++ is a tolerable, if annoying, OO language but it is hardly an
exemplary one. It does, however, have templating and the standard library
(formerly the Standard Template Library, a.k.a. STL). This allows some very
powerful and elegant code, and provides an astoundingly flexible library of
common data structures and algorithms. The Boost project is working on
creating an even more comprehensive library (for possible inclusion into
the next C++ standard). It is generic programming, enabled by C++ templates
and OO, that give C++ it's value.

As an example of how C tries and fails to do the same sort of thing,
consider the standard C qsort() function. The qsort() function is generic,
but lacks any sort of type safety. The C++ templated sort function provides
the same generic sort function, but with type safety.

[...]
} Frank
--Greg



Reply to: