This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Accepting IRIX 5.2's old-style getpwuid_r


On Aug 22, 1999, Tom Tromey <tromey@cygnus.com> wrote:

>>>>>> "Alexandre" == Alexandre Oliva <oliva@dcc.unicamp.br> writes:
Alexandre> Function overloading worked beautifully.  We can even
Alexandre> remove some other similar tests from configure.in, since
Alexandre> the overload-resolution-based ones are much more reliable.

> I don't even understand this solution.
> I guess it is time for me to read a C++ bookagain. :-(

Given an overloaded function:

int foo(int (*bar)(), ...);
int foo(long (*bar)(), ...);

Calling `foo(baz)' will select the appropriate version of foo,
depending on the return type of `baz'.  That's essentially what I've
done in the ``adaptors'' I created, except that selection is not
always based on return type, but also on function arguments.  I have
also used templates, instead of plain functions, so that I wouldn't
have to care whether the function took a pointer to const or to
non-const, for example (I found examples of both, among the platforms
I tried).  Template argument deduction would take care of picking the
appropriate type.

Alexandre> Tell me what you think about this solution.  I myself found
Alexandre> it quite ugly, but it's probably worth the ugliness.

> If this is standard C++ then I actually find it quite elegant.

Elegant, yes, but the code is ugly, because of the number of
declarations, template types, etc.

> As a nit I note your patch is missing spaces in a few places.  In most
> cases a space is required before an open paren.

Oops, sorry.  I tried to follow the rules, but it seems like I forgot
it within the adaptors :-(

Fixed, thanks

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]