Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!wuarchive!m.cs.uiuc.edu!ux1.cso.uiuc.edu!news.iastate.edu!sharkey!amara!mcdaniel From: mcdaniel@adi.com (Tim McDaniel) Newsgroups: comp.lang.c Subject: Re: How to write a sorting program that will sort everything? Message-ID: Date: 25 Mar 91 16:54:14 GMT References: <1991Mar22.005700.17663@minyos.xx.rmit.oz.au> <3403@inews.intel.com> <1991Mar23.164807.7318@helios.physics.utoronto.ca> Sender: news@adi.COM Organization: Applied Dynamics International, Inc.; Ann Arbor, Michigan, USA Lines: 25 In-reply-to: neufeld@aurora.physics.utoronto.ca's message of 23 Mar 91 16:48:07 GMT In article <1991Mar23.164807.7318@helios.physics.utoronto.ca> neufeld@aurora.physics.utoronto.ca (Christopher Neufeld) writes: Huh? I may be relatively new to C but isn't the stdlib function qsort() an example of a program which does just that? qsort() is a function, not a program, under the usual definition of "program". I believe that calling a function a program is a deplorable confusion of terms. As indicated before, a C *program* can be coded to sort many common types. Specifying the uncommon types is the problem. Where available, dynamic linking could be used, as could dynamic loading and calling of code. Extra command-line arguments to the program could specify a sort predicate program, which could be called via system() with hideous overhead on most systems. This problem might be more suited for awk, perl, icon, or other interpreted languages. The user could then enter the comparison code directly. -- "Of course he has a knife. We all have knives. It's 1183, and we're all barbarians." Tim McDaniel Applied Dynamics Int'l.; Ann Arbor, Michigan, USA Internet: mcdaniel@adi.com UUCP: {uunet,sharkey}!amara!mcdaniel