qsort()

Wolfram Roesler wolfram at cip-s08.informatik.rwth-aachen.de
Wed Apr 24 22:33:29 AEST 1991


garath at irie.ais.org (Belgarath) writes:

>qsort((char *) info, 49, sizeof(the_srtuct), compare);

>int compare(ptr1, ptr2) 
>struct the_struct *ptr1;
>struct the_struct *ptr2;
>{
>	return (strcmp(ptr1->name, ptr2->name));
>}

The problem is that this will probably work on some - many - machines. It will
certainly work on PC, ST and some Unix systems. Well, the problem in fact is
that it will not work on some other systems. Use it only if you are absolutely
sure you will never port the program to a different system or compiler (you
are NEVER sure you will never do this, however). It just isnt portable.



More information about the Comp.lang.c mailing list