delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/07/15:58:53

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 <dj AT delorie DOT com>
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><CqyGOCASqC42EwDb AT dunvegan1 DOT demon DOT co DOT uk> <7br6n8$897$1 AT news6 DOT svr DOT pol DOT co DOT uk><7bu8hk$6b6$1 AT camel19 DOT mindspring DOT com> <u79p7SA2Ls42EwHc AT xemu DOT demon DOT co DOT uk> <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

> 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!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019