Date: Sun, 7 Mar 1999 15:58:48 -0500 Message-Id: <199903072058.PAA14195@envy.delorie.com> X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f From: DJ Delorie To: djgpp AT delorie DOT com In-reply-to: <7bunlf$f86$1@camel29.mindspring.com> (rlark DOT at DOT mbhs DOT dot DOT edu AT delorie DOT com) Subject: Re: Pointers to functions. References: <7b9jku$o7o$1 AT news6 DOT svr DOT pol DOT co DOT uk> <36D9BD2F DOT A05C8E55 AT cartsys DOT com> <7br6n8$897$1 AT news6 DOT svr DOT pol DOT co DOT uk><7bu8hk$6b6$1 AT camel19 DOT mindspring DOT com> <7bunlf$f86$1 AT camel29 DOT mindspring DOT com> Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Doesn't function overloading accomplish the same thing? For example - > int add(int, int); > float add(float, float); > char * add(char *, char *); Function overloading isn't available in C, and can't be used for runtime selection of alternate functions. > all add different object types. How is this different from what you > were saying? One example is the FSEXT module in djgpp. When you initialize an extension, it calls the fsext library and passes it a pointer to one of its functions which handles those files. The fsext library stores a list of such functions as pointers to functions, and later calls them. The fsext library can't possibly use a compile-time option, because to do so would mean that *I* would have to know about all possible third-party extensions when I wrote the fsext portion of the C library!